public ConnAckPacket(bool sessionPresent, ConnectReturnCode returnCode) : base(new ConnAckVariableHeader(sessionPresent, returnCode), new PayloadNone()) { FixedHeader = FixedHeader.CreateStandardHeader(ControlPacketType.CONNACK, (UInt16)(VariableHeader.Encode().Count() + Payload.Encode().Count())); }
protected ControlPacket(VariableHeader vh, Payload pl) { VariableHeader = vh; Payload = pl; }
public IEnumerable <byte> Encode() { return(FixedHeader.Encode() .Concat(VariableHeader.Encode()) .Concat(Payload.Encode())); }
public ConnectPacket(string clientID, Will w, Authentication auth, bool cleanSession, UInt16 keepAliveTime) : base(new ConnectVariableHeader(w, auth, cleanSession, keepAliveTime), new ConnectPayload(clientID, w, auth)) { FixedHeader = FixedHeader.CreateStandardHeader(ControlPacketType.CONNECT, (UInt16)(VariableHeader.Encode().Count() + Payload.Encode().Count())); }