public bool Open(object arg) { try { _headerLogRecord = Ashley.CreateHeader(AshleyVersion.V1_1, NetDebugLogTransmissionManager.ID_N1, (ulong)BiuNetDebugAction.LogRecord, AshleyFlag.Security); _headerLogRecord.Security.Alg = AshleySecurityAlg.P4S; _server.CC = new ConnectionCreation() { Trait = SocketTrait.Normal, Type = SocketType.IPv4TCP, Protocol = _ashley, Handler = BiuIoManager.Instance.Handlers[NetDebugLogTransmissionManager.Handler_DebugN1].Handler, EndPoint = this.DebugN1EndPoint, SecurityProvider = _securityProvider }; TransmissionRouter.Instance.AddHop(this); return(_server.Create(true)); } catch { throw; } }
private IOOperation DebugN1_PublicKey(BiuIoHopArgs arg) { var peer = arg.Peer; try { RawData raw = new RawData(); if (!peer.Protocol.GetObjKept <RawData>(ref raw)) { return(IOOperation.None); } AshleyHeader header = Ashley.CreateHeader(AshleyVersion.V1_1, NetDebugLogTransmissionManager.ID_N1, (ulong)BiuAction.Ack, AshleyFlag.None); Ack ack = new Ack() { AckAction = (ulong)BiuAction.PublicKey, AckResult = (uint)BiuAckResult.OK }; if (null == peer.SecurityContext) { ack.AckResult = (uint)BiuAckResult.Unsupported; } else if (!peer.SecurityContext.ChangeRemoateKey(raw.Raw.ToArray())) { ack.AckResult = (uint)BiuAckResult.Failed; } peer.Return(ack, header); return(IOOperation.Continue); } catch { throw; } }
void DebugN1_Accepted(Peer peer, BoolArg arg) { arg.RetuenValue = true; if (null != peer.SecurityContext) { RawData raw = new RawData() { Raw = peer.SecurityContext.ExportKey().ToList() }; AshleyHeader header = Ashley.CreateHeader(AshleyVersion.V1_1, NetDebugLogTransmissionManager.ID_N1, (ulong)BiuAction.PublicKey, AshleyFlag.None); peer.Send(raw, header); } try { UserLogin(peer); } catch { } }