more API
[nyatools.git] / ncproto.d
blobe5a5dc6729f28dd3cd906cde462a4ac2bcb85814
1 /* Written by Ketmar // Invisible Vector <ketmar@ketmar.no-ip.org>
2 * Understanding is not required. Only obedience.
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 // very simple serializer
18 module ncproto is aliced;
20 import iv.vfs.io;
21 import iv.ncserial;
23 import sockchan;
26 // ////////////////////////////////////////////////////////////////////////// //
27 struct InjCodeInfo {
28 bool hasWine;
29 bool hasMono;
33 void ncSendPingback() (UDSocket sk, in auto ref InjCodeInfo nfo) {
34 sk.writeNum!ubyte(0); // version
35 sk.ncser(nfo);
39 void ncReceivePingback (UDSocket sk, ref InjCodeInfo nfo) {
40 if (sk.readNum!ubyte != 0) throw new Exception("invalid protocol version");
41 sk.ncunser(nfo);