/* CD Utils - Control-Debug utilites Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru This program 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 3 of the License, or (at your option) any later version. This program 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 program. If not, see . */ #ifndef CDUTILS_PROTOCOL_H #define CDUTILS_PROTOCOL_H #include "pistring.h" #include "cd_core_export.h" namespace CDUtils { enum CDPacketType { CD_Ping, CD_Pong, CD_KQuery, CD_KSend, CD_KDirectChange, CD_XQuery, CD_XSend, CD_XRequest, CD_XValues, CD_CQuery, CD_CSend, CD_Command, CD_MQuery, CD_MSend, CD_Message, }; # pragma pack(push,1) struct CD_CORE_EXPORT PacketHeader { int type; // CDPacketType int session_id; }; struct CD_CORE_EXPORT PacketKDirectChange { PIDeque path; PIString value; }; # pragma pack(pop) #ifdef PIP_BINARY_STREAM BINARY_STREAM_WRITE(PacketKDirectChange) {s << v.path << v.value; return s;} BINARY_STREAM_READ (PacketKDirectChange) {s >> v.path >> v.value; return s;} #else inline PIByteArray & operator <<(PIByteArray & s, const PacketKDirectChange & v) {s << v.path << v.value; return s;} inline PIByteArray & operator >>(PIByteArray & s, PacketKDirectChange & v) {s >> v.path >> v.value; return s;} #endif } #endif // CDUTILS_PROTOCOL_H