/* * SPDX-License-Identifier: GPL-3.0-or-later * * PlumbMsg — a plan9port plumbing message and its wire codec. * * Wire format (plan9port libplumb/mesg.c): * src\n source application ("ollie") * dst\n destination port ("" lets the rules decide) * wdir\n working directory (resolves relative paths) * type\n data type ("text") * attr\n space-separated name=value attributes * ndata\n decimal byte count of the data that follows * the data (NOT newline-terminated) */ #ifndef OLLIE_PLUMBMSG_H #define OLLIE_PLUMBMSG_H #include #include #include struct PlumbAttr { QString name; QString value; bool operator==(const PlumbAttr &o) const { return name == o.name && value == o.value; } }; struct PlumbMsg { QString src; QString dst; QString wdir; QString type; QList attr; QByteArray data; QString lookup(const QString &name) const; void setAttr(const QString &name, const QString &value); QByteArray pack() const; static bool unpack(const QByteArray &buf, PlumbMsg *out); }; QByteArray packPlumbAttr(const QList &attr); QList unpackPlumbAttr(const QByteArray &line); #endif