13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*------------------------------------------------------------------------- 23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program Execution Server 33c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * --------------------------------------------- 43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 53c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Copyright 2014 The Android Open Source Project 63c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 73c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Licensed under the Apache License, Version 2.0 (the "License"); 83c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * you may not use this file except in compliance with the License. 93c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * You may obtain a copy of the License at 103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * http://www.apache.org/licenses/LICENSE-2.0 123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Unless required by applicable law or agreed to in writing, software 143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * distributed under the License is distributed on an "AS IS" BASIS, 153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * See the License for the specific language governing permissions and 173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * limitations under the License. 183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*! 203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \file 213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Execution Server Protocol. 223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "xsProtocol.hpp" 253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 263c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing std::string; 273c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing std::vector; 283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 293c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace xs 303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 323c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline deUint32 swapEndianess (deUint32 value) 333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 b0 = (value >> 0) & 0xFF; 353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 b1 = (value >> 8) & 0xFF; 363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 b2 = (value >> 16) & 0xFF; 373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 b3 = (value >> 24) & 0xFF; 383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return (b0 << 24) | (b1 << 16) | (b2 << 8) | b3; 393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 413c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytemplate <typename T> T networkToHost (T value); 423c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytemplate <typename T> T hostToNetwork (T value); 433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 443c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytemplate <> int networkToHost (int value) { return (int)swapEndianess((deUint32)value); } 453c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytemplate <> int hostToNetwork (int value) { return (int)swapEndianess((deUint32)value); } 463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 473c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass MessageParser 483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 493c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MessageParser (const deUint8* data, int dataSize) 513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : m_data (data) 523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_size (dataSize) 533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_pos (0) 543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry template <typename T> 583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry T get (void) 593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry XS_CHECK_MSG(m_pos + (int)sizeof(T) <= m_size, "Invalid payload size"); 613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry T netValue; 623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deMemcpy(&netValue, &m_data[m_pos], sizeof(T)); 633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_pos += sizeof(T); 643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return networkToHost(netValue); 653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void getString (std::string& dst) 683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // \todo [2011-09-30 pyry] We should really send a size parameter instead. 703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry while (m_data[m_pos] != 0) 713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry dst += (char)m_data[m_pos++]; 733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry XS_CHECK_MSG(m_pos < m_size, "Unterminated string payload"); 743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_pos += 1; 773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void assumEnd (void) 803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (m_pos != m_size) 823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry XS_FAIL("Invalid payload size"); 833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 853c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const deUint8* m_data; 873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int m_size; 883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int m_pos; 893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 913c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass MessageWriter 923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 933c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MessageWriter (MessageType msgType, std::vector<deUint8>& buf) 953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : m_buf(buf) 963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Place for size. 983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry put<int>(0); 993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Write message type. 1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry put<int>(msgType); 1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~MessageWriter (void) 1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry finalize(); 1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void finalize (void) 1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_ASSERT(m_buf.size() >= MESSAGE_HEADER_SIZE); 1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Write actual size. 1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int size = hostToNetwork((int)m_buf.size()); 1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deMemcpy(&m_buf[0], &size, sizeof(int)); 1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry template <typename T> 1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void put (T value) 1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry T netValue = hostToNetwork(value); 1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry size_t curPos = m_buf.size(); 1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_buf.resize(curPos + sizeof(T)); 1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deMemcpy(&m_buf[curPos], &netValue, sizeof(T)); 1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::vector<deUint8>& m_buf; 1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytemplate <> 1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MessageWriter::put<const char*> (const char* value) 1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int curPos = (int)m_buf.size(); 1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int strLen = (int)strlen(value); 1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_buf.resize(curPos + strLen+1); 1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deMemcpy(&m_buf[curPos], &value[0], strLen+1); 1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid Message::parseHeader (const deUint8* data, int dataSize, MessageType& type, int& size) 1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry XS_CHECK_MSG(dataSize >= MESSAGE_HEADER_SIZE, "Incomplete header"); 1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MessageParser parser(data, dataSize); 1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry size = (MessageType)parser.get<int>(); 1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry type = (MessageType)parser.get<int>(); 1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid Message::writeHeader (MessageType type, int messageSize, deUint8* dst, int bufSize) 1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry XS_CHECK_MSG(bufSize >= MESSAGE_HEADER_SIZE, "Incomplete header"); 1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int netSize = hostToNetwork(messageSize); 1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int netType = hostToNetwork((int)type); 1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deMemcpy(dst+0, &netSize, sizeof(netSize)); 1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deMemcpy(dst+4, &netType, sizeof(netType)); 1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid Message::writeNoData (vector<deUint8>& buf) const 1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MessageWriter writer(type, buf); 1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1633c827367444ee418f129b2c238299f49d3264554Jarkko PoyryHelloMessage::HelloMessage (const deUint8* data, int dataSize) 1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : Message(MESSAGETYPE_HELLO) 1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MessageParser parser(data, dataSize); 1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry version = parser.get<int>(); 1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry parser.assumEnd(); 1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid HelloMessage::write (vector<deUint8>& buf) const 1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MessageWriter writer(type, buf); 1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry writer.put(version); 1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1773c827367444ee418f129b2c238299f49d3264554Jarkko PoyryTestMessage::TestMessage (const deUint8* data, int dataSize) 1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : Message(MESSAGETYPE_TEST) 1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MessageParser parser(data, dataSize); 1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry parser.getString(test); 1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry parser.assumEnd(); 1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid TestMessage::write (vector<deUint8>& buf) const 1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MessageWriter writer(type, buf); 1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry writer.put(test.c_str()); 1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1913c827367444ee418f129b2c238299f49d3264554Jarkko PoyryExecuteBinaryMessage::ExecuteBinaryMessage (const deUint8* data, int dataSize) 1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : Message(MESSAGETYPE_EXECUTE_BINARY) 1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MessageParser parser(data, dataSize); 1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry parser.getString(name); 1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry parser.getString(params); 1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry parser.getString(workDir); 1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry parser.getString(caseList); 1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry parser.assumEnd(); 2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid ExecuteBinaryMessage::write (vector<deUint8>& buf) const 2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MessageWriter writer(type, buf); 2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry writer.put(name.c_str()); 2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry writer.put(params.c_str()); 2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry writer.put(workDir.c_str()); 2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry writer.put(caseList.c_str()); 2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2113c827367444ee418f129b2c238299f49d3264554Jarkko PoyryProcessLogDataMessage::ProcessLogDataMessage (const deUint8* data, int dataSize) 2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : Message(MESSAGETYPE_PROCESS_LOG_DATA) 2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MessageParser parser(data, dataSize); 2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry parser.getString(logData); 2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry parser.assumEnd(); 2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid ProcessLogDataMessage::write (vector<deUint8>& buf) const 2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MessageWriter writer(type, buf); 2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry writer.put(logData.c_str()); 2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2253c827367444ee418f129b2c238299f49d3264554Jarkko PoyryProcessLaunchFailedMessage::ProcessLaunchFailedMessage (const deUint8* data, int dataSize) 2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : Message(MESSAGETYPE_PROCESS_LAUNCH_FAILED) 2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MessageParser parser(data, dataSize); 2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry parser.getString(reason); 2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry parser.assumEnd(); 2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid ProcessLaunchFailedMessage::write (vector<deUint8>& buf) const 2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MessageWriter writer(type, buf); 2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry writer.put(reason.c_str()); 2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2393c827367444ee418f129b2c238299f49d3264554Jarkko PoyryProcessFinishedMessage::ProcessFinishedMessage (const deUint8* data, int dataSize) 2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : Message(MESSAGETYPE_PROCESS_FINISHED) 2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MessageParser parser(data, dataSize); 2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry exitCode = parser.get<int>(); 2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry parser.assumEnd(); 2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid ProcessFinishedMessage::write (vector<deUint8>& buf) const 2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MessageWriter writer(type, buf); 2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry writer.put(exitCode); 2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2533c827367444ee418f129b2c238299f49d3264554Jarkko PoyryInfoMessage::InfoMessage (const deUint8* data, int dataSize) 2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : Message(MESSAGETYPE_INFO) 2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MessageParser parser(data, dataSize); 2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry parser.getString(info); 2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry parser.assumEnd(); 2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid InfoMessage::write (vector<deUint8>& buf) const 2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MessageWriter writer(type, buf); 2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry writer.put(info.c_str()); 2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // xs 268