コード例 #1
0
 public GoIpRecordEventArgs(string message, GoIpRecordPacket packet, string host, int port)
 {
     Message = message;
     Packet  = packet;
     Host    = host;
     Port    = port;
 }
コード例 #2
0
ファイル: GoIpSmsServer.cs プロジェクト: lszabados/GoIPSms
        private void RecordData(string data, string host, int port)
        {
            _logger.LogDebug("Start GoIp Record event");

            GoIpRecordPacket packet = new GoIpRecordPacket(data);

            // if auth error
            if (packet.authid != _options.AuthId || packet.password != _options.AuthPassword)
            {
                // TODO: log?
                _logger.LogInformation("GoIp record event authentication error. Data: {0}", data);
                Send(ACKPacketFactory.ACK("RECORD", packet.receiveid.ToString(), "Record event authentication error!"), host, port);
                OnRecord?.Invoke(this, new GoIpRecordEventArgs("GoIp record event authentication error!", packet, host, port));
                return;
            }

            packet.password = "";  // Delete password for security reasons

            _logger.LogInformation("Received GoIp record event. ReceiveId: {0} Send num: {1} Direction: {2}", packet.receiveid, packet.send_num, packet.direction);

            Send(ACKPacketFactory.ACK("RECORD", packet.receiveid.ToString(), ""), host, port);
            OnRecord?.Invoke(this, new GoIpRecordEventArgs("OK", packet, host, port));
        }