fixes for new ncrpc
[nyatools.git] / ncproto.d
blobb5bb97bade836f875eaeaf4636c03f368e50b852
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.ncrpc;
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);
45 // ////////////////////////////////////////////////////////////////////////// //
46 public struct AssemblyInfo {
47 uint id;
48 string name;
52 // ////////////////////////////////////////////////////////////////////////// //
53 public struct NCClassInfo {
54 uint id;
55 uint asmid;
56 string name;
57 string nspace;
58 // constructed
59 @NCIgnore string asmname;
60 @NCIgnore string fullname;
61 @NCIgnore string fullnamenoasm;
63 bool isNameEqu (const(char)[] name) const {
64 import std.algorithm : endsWith;
65 if (!fullname.endsWith(name)) return false;
66 if (fullname.length == name.length) return true;
67 if (fullname[$-name.length-1] != '.') return false;
68 return true;
73 // ////////////////////////////////////////////////////////////////////////// //
74 public struct FieldInfo {
75 uint type;
76 uint ofs;
77 uint flags;
78 string name;
79 string typename;
83 // ////////////////////////////////////////////////////////////////////////// //
84 __gshared string delegate (uint asmid) getAssemblyName;
85 __gshared AssemblyInfo[] delegate () enumAssemblies;
86 __gshared NCClassInfo[] delegate (uint asmid=0) getClassList;
87 __gshared FieldInfo[] delegate (uint clsid) getClassFields;