remove svn:executable from .cs files
[mono.git] / mcs / class / Npgsql / Npgsql / NpgsqlStartupState.cs
1 // Npgsql.NpgsqlStartupState.cs
2 //
3 // Author:
4 //      Dave Joyner <d4ljoyn@yahoo.com>
5 //
6 //      Copyright (C) 2002 The Npgsql Development Team
7 //      npgsql-general@gborg.postgresql.org
8 //      http://gborg.postgresql.org/project/npgsql/projdisplay.php
9 //
10 // This library is free software; you can redistribute it and/or
11 // modify it under the terms of the GNU Lesser General Public
12 // License as published by the Free Software Foundation; either
13 // version 2.1 of the License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23
24
25 using System;
26 using System.IO;
27 using System.Net;
28 using System.Net.Sockets;
29
30 namespace Npgsql
31 {
32
33
34     internal sealed class NpgsqlStartupState : NpgsqlState
35     {
36         private static NpgsqlStartupState _instance = null;
37
38         private readonly String CLASSNAME = "NpgsqlStartupState";
39
40         private NpgsqlStartupState() : base()
41         { }
42
43         public static NpgsqlStartupState Instance
44         {
45             get
46             {
47                 if ( _instance == null )
48                 {
49                     _instance = new NpgsqlStartupState();
50                 }
51                 return _instance;
52             }
53         }
54         public override void Authenticate( NpgsqlConnector context, string password)
55         {
56             NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Authenticate");
57             NpgsqlPasswordPacket pwpck = new NpgsqlPasswordPacket(password, context.BackendProtocolVersion);
58             BufferedStream stream = new BufferedStream(context.Stream);
59             pwpck.WriteToStream(stream, context.Encoding);
60             stream.Flush();
61
62         }
63     }
64 }