public routedMessage(byte[] buff, int start, int len) { _address = new route(buff, start); _command = new List <byte>(len - _address.Length); int cmdStart = start + _address.Length; for (int i = 0; i < len - _address.Length; i++) { _command.Add(buff[cmdStart + i]); } }
public route getReturnRoute() { route ret = new route(); ret._address = new byte[Length]; ret._address[0] = (byte)((Length - 1) << 4); for (int i = 1; i < Length; i++) { ret._address[i] = _address[Length - i]; } return(ret); }
public routedMessage getNextRequest() { //take child off top of list if (UnwalkedRoutes.Count > 0) { route next = UnwalkedRoutes[0]; UnwalkedRoutes.RemoveAt(0); routedMessage request = new routedMessage(next, enumerateMsg); return(request); } return(null); }
public void enumerateResponse(routedMessage resp) { route from = resp.Route.getReturnRoute(); commandReader reader = resp.getReader(); reader.ReadByte(); string name = reader.ReadString(); //add to tree under parent //_parent.findNode(from); routedNode p = _parent; //problem with not having the first part of the address // TODO do it properly! int i; if (from.Length > 1) { p = p.children[0]; for (i = 1; i < from.Length - 1; i++) { byte childIdx = from.getLink(i - 1); p = p.children[childIdx]; } p.children.Add(from.getLink(i - 1), new routedNode(name, from)); } else { p.children.Add(0, new routedNode(name, from)); } // else if (from.Length == 2) p.children[0].children.Add((byte)p.children[0].children.Count, new routedNode(name, from)); // else p.children.Add(from.getLink(i-1), new routedNode(name,from)); //add children to unwalked list try { while (1 == 1) { byte con = reader.ReadByte(); UnwalkedRoutes.Add(new route(from, con)); } } catch (Exception) { } }
public routedMessage(route Route, byte[] cmd) { _address = Route; _command = new List <byte>(cmd); }
public routedNode(string Name, route Route) { name = Name; _route = Route; }
public routedNode(string Name) { name = Name; _route = route.DirectLink; }