public static G2Packet getPacketByHeader(Header h) { G2Packet packet = null; switch (h.type) { case G2PacketType.PVU: packet = new G2PacketPVU(h); break; case G2PacketType.COM: packet = new G2PacketCOM(h); break; case G2PacketType.PART: packet = new G2PacketPART(h); break; case G2PacketType.SZ: packet = new G2PacketSZ(h); break; case G2PacketType.Q2: packet = new G2PacketQ2(h); break; case G2PacketType.DN: packet = new G2PacketDN(h); break; case G2PacketType.KHL: packet = new G2PacketKHL(h); break; case G2PacketType.QA: packet = new G2PacketQA(h); break; case G2PacketType.SS: packet = new G2PacketSS(h); break; case G2PacketType.QH2: packet = new G2PacketQH2(h); break; case G2PacketType.HG: packet = new G2PacketHG(h); break; case G2PacketType.PI: packet = new G2PacketPI(h); break; case G2PacketType.UDP: packet = new G2PacketUDP(h); break; case G2PacketType.PO: packet = new G2PacketPO(h); break; case G2PacketType.S: packet = new G2PacketS(h); break; case G2PacketType.D: packet = new G2PacketD(h); break; case G2PacketType.LNI: packet = new G2PacketLNI(h); break; case G2PacketType.GU: packet = new G2PacketGU(h); break; case G2PacketType.NA: packet = new G2PacketNA(h); break; case G2PacketType.QKR: packet = new G2PacketQKR(h); break; case G2PacketType.QKA: packet = new G2PacketQKA(h); break; case G2PacketType.SNA: packet = new G2PacketSNA(h); break; case G2PacketType.QNA: packet = new G2PacketQNA(h); break; case G2PacketType.V: packet = new G2PacketV(h); break; case G2PacketType.LS: packet = new G2PacketLS(h); break; case G2PacketType.HS: packet = new G2PacketHS(h); break; case G2PacketType.TLS: packet = new G2PacketTLS(h); break; case G2PacketType.TS: packet = new G2PacketTS(h); break; case G2PacketType.NH: packet = new G2PacketNH(h); break; case G2PacketType.RA: packet = new G2PacketRA(h); break; case G2PacketType.BUP: packet = new G2PacketBUP(h); break; case G2PacketType.H: packet = new G2PacketH(h); break; case G2PacketType.URL: packet = new G2PacketURL(h); break; case G2PacketType.URN: packet = new G2PacketURN(h); break; case G2PacketType.UPRO: packet = new G2PacketUPRO(h); break; case G2PacketType.NICK: packet = new G2PacketNICK(h); break; case G2PacketType.BH: packet = new G2PacketBH(h); break; case G2PacketType.FW: packet = new G2PacketFW(h); break; case G2PacketType.MD: packet = new G2PacketMD(h); break; case G2PacketType.UPROC: packet = new G2PacketUPROC(h); break; case G2PacketType.UPROD: packet = new G2PacketUPROD(h); break; case G2PacketType.XML: packet = new G2PacketXML(h); break; default: packet = new G2PacketDefault(h); break; } return(packet); }
public static G2Packet getPacketByHeader(Header h) { G2Packet packet = null; switch(h.type) { case G2PacketType.PVU: packet = new G2PacketPVU (h); break; case G2PacketType.COM: packet = new G2PacketCOM (h); break; case G2PacketType.PART: packet = new G2PacketPART(h); break; case G2PacketType.SZ: packet = new G2PacketSZ (h); break; case G2PacketType.Q2: packet = new G2PacketQ2 (h); break; case G2PacketType.DN: packet = new G2PacketDN (h); break; case G2PacketType.KHL: packet = new G2PacketKHL (h); break; case G2PacketType.QA: packet = new G2PacketQA (h); break; case G2PacketType.SS: packet = new G2PacketSS (h); break; case G2PacketType.QH2: packet = new G2PacketQH2 (h); break; case G2PacketType.HG: packet = new G2PacketHG (h); break; case G2PacketType.PI: packet = new G2PacketPI (h); break; case G2PacketType.UDP: packet = new G2PacketUDP (h); break; case G2PacketType.PO: packet = new G2PacketPO (h); break; case G2PacketType.S: packet = new G2PacketS(h); break; case G2PacketType.D: packet = new G2PacketD(h); break; case G2PacketType.LNI: packet = new G2PacketLNI (h); break; case G2PacketType.GU: packet = new G2PacketGU (h); break; case G2PacketType.NA: packet = new G2PacketNA (h); break; case G2PacketType.QKR: packet = new G2PacketQKR (h); break; case G2PacketType.QKA: packet = new G2PacketQKA (h); break; case G2PacketType.SNA: packet = new G2PacketSNA (h); break; case G2PacketType.QNA: packet = new G2PacketQNA (h); break; case G2PacketType.V: packet = new G2PacketV (h); break; case G2PacketType.LS: packet = new G2PacketLS (h); break; case G2PacketType.HS: packet = new G2PacketHS (h); break; case G2PacketType.TLS: packet = new G2PacketTLS (h); break; case G2PacketType.TS: packet = new G2PacketTS (h); break; case G2PacketType.NH: packet = new G2PacketNH (h); break; case G2PacketType.RA: packet = new G2PacketRA (h); break; case G2PacketType.BUP: packet = new G2PacketBUP (h); break; case G2PacketType.H: packet = new G2PacketH (h); break; case G2PacketType.URL: packet = new G2PacketURL (h); break; case G2PacketType.URN: packet = new G2PacketURN (h); break; case G2PacketType.UPRO: packet = new G2PacketUPRO (h); break; case G2PacketType.NICK: packet = new G2PacketNICK (h); break; case G2PacketType.BH: packet = new G2PacketBH (h); break; case G2PacketType.FW: packet = new G2PacketFW (h); break; case G2PacketType.MD: packet = new G2PacketMD (h); break; case G2PacketType.UPROC: packet = new G2PacketUPROC(h); break; case G2PacketType.UPROD : packet = new G2PacketUPROD(h); break; case G2PacketType.XML: packet = new G2PacketXML(h); break; default : packet = new G2PacketDefault (h); break; } return packet; }
/** * Parse the neighbours hubs contained in this packet * and adds them to the cache * */ private G2Packet HandlePacketKHL(NodePeer p, G2PacketKHL pack) { foreach (G2Packet child in pack.children) { if (child.type != G2PacketType.NH) continue; G2PacketNH nh = child as G2PacketNH; if (nh != null && nh.node != null) { GHubCache.Instance.AddHub(new NodePeer(nh.node,true)); } } return null; }