/// <summary> /// コンストラクタ /// </summary> /// <param name="serverHost_">接続先ホスト</param> /// <param name="serverPort_">接続先ポート</param> /// <param name="userName_">ユーザ名</param> /// <param name="authType_">認証方式</param> /// <param name="userPassword_">パスワード</param> /// <param name="nasIpAddress_">NAS IP</param> /// <param name="secret_">共有鍵</param> /// <remarks> /// <para> /// 共有鍵は PAP でのみ使います /// </para> /// </remarks> public RadiusClient(string serverHost_, string serverPort_, string userName_, AUTH_TYPE authType_, string userPassword_, string nasIpAddress_, string secret_) { serverHost = serverHost_; serverPort = serverPort_; userName = userName_; authType = authType_; userPassword = userPassword_; nasIpAddress = nasIpAddress_; secret = secret_; request = new RadiusPacket(); request.Code = RadiusPacket.CODE.ACCESS_REQUEST; request.AppendAttribute(new RadiusPacket.ValuePair(RadiusPacket.TYPE.USER_NAME, userName)); switch (authType) { case AUTH_TYPE.PAP: request.SetSecret(secret); request.AppendAttribute(new RadiusPacket.ValuePair(RadiusPacket.TYPE.USER_PASSWORD, userPassword)); break; case AUTH_TYPE.CHAP: request.AppendAttribute(new RadiusPacket.ValuePair(RadiusPacket.TYPE.CHAP_PASSWORD, userPassword)); break; } request.AppendAttribute(new RadiusPacket.ValuePair(RadiusPacket.TYPE.NAS_IP_ADDRESS, nasIpAddress)); request.BuildPacket(); }