/** * This is called when we are done crafting our packet (adding children etc etc) * This creates the header, and set the right values for payload length etc etc * */ public void FinalizePacket() { foreach (G2Packet child in children) child.FinalizePacket (); packetHeader = new Header(this); }
public G2PacketSS(Header h) : base(h) { this.type = G2PacketType.SS; }
public G2PacketString(Header h) : base(h) { Str = ""; bytes = null; }
public G2PacketV(Header h) : base(h) { this.type = G2PacketType.V; }
public void Write(MemoryStream stream) { if(packetHeader == null) packetHeader = new Header(this); packetHeader.Write(stream); WriteChildren(stream); WritePayload(stream); }
public G2PacketKHL(Header h) : base(h) { this.type = G2PacketType.KHL; }
public G2PacketTLS(Header h) : base(h) { this.type = G2PacketType.TLS; }
public G2PacketQ2(Header h) : base(h) { this.type = G2PacketType.Q2; this.guid = null; }
public G2PacketUPROC(Header h) : base(h) { this.type = G2PacketType.UPROC; }
public G2PacketSNA(Header h) : base(h) { this.type = G2PacketType.SNA; }
public G2PacketDN(Header h) : base(h) { this.type = G2PacketType.DN; }
public G2PacketURN(Header h) : base(h) { this.type = G2PacketType.URN; }
public G2PacketSZ(Header h) : base(h) { this.type = G2PacketType.SZ; Size = 0; }
public G2PacketBH(Header h) : base(h) { this.type = G2PacketType.BH; }
public G2PacketS(Header h) : base(h) { this.type = G2PacketType.S; Node = null; Timestamp = -1; }
public G2PacketXML(Header h ) : base(h) { this.type = G2PacketType.XML; this.profile = null; }
public G2PacketQA(Header packHeader) : base(packHeader) { type = G2PacketType.QA; }
public G2PacketUDP(Header h) : base(h) { this.type = G2PacketType.UDP; EndPoint = null; }
public G2PacketNH(Header h) : base(h) { this.type = G2PacketType.NH; }
public G2PacketPI(Header h ) : base(h) { this.type = G2PacketType.PI; }
public G2PacketHS(Header h) : base(h) { type = G2PacketType.HS; }
public G2PacketPO(Header h) : base(h) { this.type = G2PacketType.PO; }
public G2PacketLNI(Header h) : base(h) { this.type = G2PacketType.LNI; }
public G2PacketQKA(Header h) : base(h) { this.type = G2PacketType.QKA; }
public G2PacketDefault(Header h) : base(h) { this.type = G2PacketType.DEFAULT; payload = new byte[h.PayloadLength]; }
public G2PacketRA(Header h) : base(h) { timeDelay = null; this.type = G2PacketType.RA; }
// to be called when reading packet from stream public G2Packet(Header h) { this.children = new List<G2Packet> (); this.packetHeader = h; RemotePeer = null; }
public G2PacketD(Header h) : base(h) { this.type = G2PacketType.D; Node = null; }
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 G2PacketQH2(Header h) : base(h) { this.type = G2PacketType.QH2; this.hopCount = 0; this.searchGuid = null; }