pgsqlclient-checkins Mailing List for PostgreSqlClient (Page 37)
Status: Inactive
Brought to you by:
carlosga_fb
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(120) |
Aug
(95) |
Sep
(95) |
Oct
(213) |
Nov
(114) |
Dec
(64) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(6) |
Feb
(134) |
Mar
(88) |
Apr
(28) |
May
(22) |
Jun
(15) |
Jul
(23) |
Aug
(2) |
Sep
(15) |
Oct
(2) |
Nov
(6) |
Dec
|
| 2005 |
Jan
(8) |
Feb
(6) |
Mar
|
Apr
(42) |
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
(84) |
Oct
|
Nov
|
Dec
|
| 2006 |
Jan
|
Feb
|
Mar
(84) |
Apr
(46) |
May
(40) |
Jun
(8) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <car...@us...> - 2003-10-20 18:24:11
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10 In directory sc8-pr-cvs1:/tmp/cvs-serv30109 Modified Files: changelog.txt Log Message: Updated CHANGELOG.TXT Index: changelog.txt =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/changelog.txt,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** changelog.txt 20 Oct 2003 10:01:55 -0000 1.52 --- changelog.txt 20 Oct 2003 18:23:31 -0000 1.53 *************** *** 19,22 **** --- 19,24 ---- TlsCipherSuiteFactory.cs + TlsCompressionMethod.cs + - Added new cipher suites definitions based on RFC3268 - (http://www.ietf.org/rfc/rfc3268.txt) |
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake/Mono.Security.Protocol.Tls.Handshake.Client In directory sc8-pr-cvs1:/tmp/cvs-serv29981 Modified Files: TlsClientHello.cs TlsServerHello.cs Log Message: Added new TlsCompressionMethod enumeration Index: TlsClientHello.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TlsClientHello.cs 20 Oct 2003 10:01:19 -0000 1.5 --- TlsClientHello.cs 20 Oct 2003 18:22:57 -0000 1.6 *************** *** 109,113 **** // Compression methods ( 0 = none ) ! Write((byte)0); } --- 109,113 ---- // Compression methods ( 0 = none ) ! Write((byte)TlsCompressionMethod.None); } Index: TlsServerHello.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHello.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TlsServerHello.cs 20 Oct 2003 10:01:19 -0000 1.5 --- TlsServerHello.cs 20 Oct 2003 18:22:57 -0000 1.6 *************** *** 31,40 **** #region FIELDS ! private TlsProtocol protocol; ! private byte[] random; ! private byte[] sessionId; ! private TlsCipherSuite cipherSuite; ! private byte compressionMethod; ! #endregion --- 31,40 ---- #region FIELDS ! private TlsProtocol protocol; ! private TlsCompressionMethod compressionMethod; ! private byte[] random; ! private byte[] sessionId; ! private TlsCipherSuite cipherSuite; ! #endregion *************** *** 95,99 **** // Read compression methods ( always 0 ) ! this.compressionMethod = this.ReadByte(); } --- 95,99 ---- // Read compression methods ( always 0 ) ! this.compressionMethod = (TlsCompressionMethod)this.ReadByte(); } |
|
From: <car...@us...> - 2003-10-20 18:21:48
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls
In directory sc8-pr-cvs1:/tmp/cvs-serv29810
Modified Files:
TlsSession.cs TlsSessionContext.cs TlsSessionSettings.cs
Log Message:
Added new TlsCompressionMethod enumeration
Index: TlsSession.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/TlsSession.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** TlsSession.cs 20 Oct 2003 09:58:29 -0000 1.3
--- TlsSession.cs 20 Oct 2003 18:21:43 -0000 1.4
***************
*** 167,173 ****
try
{
! this.context.Protocol = settings.Protocol;
! this.state = TlsSessionState.OpeningSecure;
! this.supportedCiphers = TlsCipherSuiteFactory.GetSupportedCiphers(context.Protocol);
this.socket.DoHandshake();
this.state = TlsSessionState.OpenSecure;
--- 167,174 ----
try
{
! this.context.Protocol = settings.Protocol;
! this.context.CompressionMethod = settings.CompressionMethod;
! this.state = TlsSessionState.OpeningSecure;
! this.supportedCiphers = TlsCipherSuiteFactory.GetSupportedCiphers(context.Protocol);
this.socket.DoHandshake();
this.state = TlsSessionState.OpenSecure;
Index: TlsSessionContext.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/TlsSessionContext.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** TlsSessionContext.cs 20 Oct 2003 09:58:29 -0000 1.5
--- TlsSessionContext.cs 20 Oct 2003 18:21:43 -0000 1.6
***************
*** 39,42 ****
--- 39,45 ----
private TlsProtocol protocol;
+ // Compression method
+ private TlsCompressionMethod compressionMethod;
+
// Information sent and request by the server in the Handshake protocol
private TlsServerSettings serverSettings;
***************
*** 46,50 ****
private bool connectionEnd;
private TlsCipherSuite cipher;
- private int compressionMethod;
// Sequence numbers
--- 49,52 ----
***************
*** 78,81 ****
--- 80,89 ----
}
+ public TlsCompressionMethod CompressionMethod
+ {
+ get { return compressionMethod; }
+ set { compressionMethod = value; }
+ }
+
public TlsServerSettings ServerSettings
{
***************
*** 102,111 ****
}
- public int CompressionMethod
- {
- get { return compressionMethod; }
- set { compressionMethod = value; }
- }
-
public TlsHandshakeHashes HandshakeHashes
{
--- 110,113 ----
***************
*** 186,189 ****
--- 188,192 ----
{
this.protocol = TlsProtocol.Tls1;
+ this.compressionMethod = TlsCompressionMethod.None;
this.serverSettings = new TlsServerSettings();
this.handshakeHashes = new TlsHandshakeHashes();
Index: TlsSessionSettings.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/TlsSessionSettings.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** TlsSessionSettings.cs 11 Oct 2003 10:04:20 -0000 1.1
--- TlsSessionSettings.cs 20 Oct 2003 18:21:43 -0000 1.2
***************
*** 37,40 ****
--- 37,41 ----
private Encoding encoding;
private TlsProtocol protocol;
+ private TlsCompressionMethod compressionMethod;
private X509CertificateCollection certificates;
***************
*** 74,77 ****
--- 75,91 ----
}
+ public TlsCompressionMethod CompressionMethod
+ {
+ get { return compressionMethod; }
+ set
+ {
+ if (value != TlsCompressionMethod.None)
+ {
+ throw new NotSupportedException("Specified compression method is not supported");
+ }
+ compressionMethod = value;
+ }
+ }
+
public X509CertificateCollection Certificates
{
***************
*** 87,90 ****
--- 101,105 ----
{
this.protocol = TlsProtocol.Tls1;
+ this.compressionMethod = TlsCompressionMethod.None;
this.certificates = new X509CertificateCollection();
this.serverName = "localhost";
|
|
From: <car...@us...> - 2003-10-20 18:21:15
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls In directory sc8-pr-cvs1:/tmp/cvs-serv29754 Added Files: TlsCompressionMethod.cs Log Message: Added new TlsCompressionMethod enumeration --- NEW FILE: TlsCompressionMethod.cs --- (This appears to be a binary file; contents omitted.) |
|
From: <car...@us...> - 2003-10-20 14:39:07
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake In directory sc8-pr-cvs1:/tmp/cvs-serv29796 Modified Files: TlsHandshakeMessage.cs Log Message: * TLS implementation: - Fixed padding length calculation on record encryption. - Abstracted CipherSuite classes for allow work with other protocol versions. - Added new files : TlsAbstractCipherSuite.cs TlsSslCipherSuite.cs TlsCipherSuiteFactory.cs - Added new cipher suites definitions based on RFC3268 - (http://www.ietf.org/rfc/rfc3268.txt) - Added two new supported ciphersuites for TLS protocol: TLS_RSA_WITH_AES_256_CBC_SHA TLS_RSA_WITH_AES_128_CBC_SHA - Moved key generation stuff to specific cipher suite classes. Index: TlsHandshakeMessage.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake/TlsHandshakeMessage.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TlsHandshakeMessage.cs 16 Oct 2003 14:25:43 -0000 1.6 --- TlsHandshakeMessage.cs 20 Oct 2003 10:00:35 -0000 1.7 *************** *** 28,32 **** namespace Mono.Security.Protocol.Tls.Handshake { ! internal class TlsHandshakeMessage : TlsStream { #region FIELDS --- 28,32 ---- namespace Mono.Security.Protocol.Tls.Handshake { ! internal abstract class TlsHandshakeMessage : TlsStream { #region FIELDS *************** *** 83,86 **** --- 83,94 ---- #endregion + #region ABSTRACT_METHODS + + protected abstract void ProcessAsTls1(); + + protected abstract void ProcessAsSsl3(); + + #endregion + #region METHODS *************** *** 124,135 **** return result; - } - - protected virtual void ProcessAsTls1() - { - } - - protected virtual void ProcessAsSsl3() - { } --- 132,135 ---- |
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls In directory sc8-pr-cvs1:/tmp/cvs-serv29414 Modified Files: TlsCipherSuite.cs TlsCipherSuiteCollection.cs TlsSession.cs TlsSessionContext.cs Log Message: * TLS implementation: - Fixed padding length calculation on record encryption. - Abstracted CipherSuite classes for allow work with other protocol versions. - Added new files : TlsAbstractCipherSuite.cs TlsSslCipherSuite.cs TlsCipherSuiteFactory.cs - Added new cipher suites definitions based on RFC3268 - (http://www.ietf.org/rfc/rfc3268.txt) - Added two new supported ciphersuites for TLS protocol: TLS_RSA_WITH_AES_256_CBC_SHA TLS_RSA_WITH_AES_128_CBC_SHA - Moved key generation stuff to specific cipher suite classes. Index: TlsCipherSuite.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/TlsCipherSuite.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsCipherSuite.cs 13 Oct 2003 19:13:30 -0000 1.2 --- TlsCipherSuite.cs 20 Oct 2003 09:58:29 -0000 1.3 *************** *** 34,155 **** namespace Mono.Security.Protocol.Tls { ! internal class TlsCipherSuite { - #region FIELDS - - private short code; - private string name; - private string algName; - private string hashName; - private bool isExportable; - private CipherMode cipherMode; - private byte keyMaterialSize; - private byte expandedKeyMaterialSize; - private byte effectiveKeyBits; - private byte ivSize; - private byte blockSize; - private TlsSessionContext sessionContext; - private SymmetricAlgorithm encryptionAlgorithm; - private ICryptoTransform encryptionCipher; - private SymmetricAlgorithm decryptionAlgorithm; - private ICryptoTransform decryptionCipher; - private KeyedHashAlgorithm clientHMAC; - private KeyedHashAlgorithm serverHMAC; - - #endregion - - #region PROPERTIES - - public short Code - { - get { return code; } - } - - public string Name - { - get { return name; } - } - - public bool IsExportable - { - get { return isExportable; } - } - - public CipherMode CipherMode - { - get { return cipherMode; } - } - - public int HashSize - { - get { return (int)(hashName == "MD5" ? 16 : 20); } - } - - public byte KeyMaterialSize - { - get { return keyMaterialSize; } - } - - public byte ExpandedKeyMaterialSize - { - get { return expandedKeyMaterialSize; } - } - - public byte EffectiveKeyBits - { - get { return EffectiveKeyBits; } - } - - public byte IvSize - { - get { return ivSize; } - } - - public byte BlockSize - { - get { return blockSize; } - } - - public string HashName - { - get { return hashName; } - } - - public TlsSessionContext SessionState - { - get { return sessionContext; } - set { sessionContext = value; } - } - - public KeyedHashAlgorithm ClientHMAC - { - get { return clientHMAC; } - } - - public KeyedHashAlgorithm ServerHMAC - { - get { return serverHMAC; } - } - - #endregion - #region CONSTRUCTORS ! public TlsCipherSuite(short code, string name, string algName, string hashName, bool exportable, bool blockMode, byte keyMaterialSize, byte expandedKeyMaterialSize, byte effectiveKeyBytes, byte ivSize, byte blockSize) { - this.code = code; - this.name = name; - this.algName = algName; - this.hashName = hashName; - this.isExportable = exportable; - if (blockMode) - { - this.cipherMode = CipherMode.CBC; - } - this.keyMaterialSize = keyMaterialSize; - this.expandedKeyMaterialSize = expandedKeyMaterialSize; - this.effectiveKeyBits = effectiveKeyBits; - this.ivSize = ivSize; - this.blockSize = blockSize; } --- 34,49 ---- namespace Mono.Security.Protocol.Tls { ! internal class TlsCipherSuite : TlsAbstractCipherSuite { #region CONSTRUCTORS ! public TlsCipherSuite(short code, string name, string algName, ! string hashName, bool exportable, bool blockMode, ! byte keyMaterialSize, byte expandedKeyMaterialSize, ! short effectiveKeyBytes, byte ivSize, byte blockSize) ! : base (code, name, algName, hashName, exportable, blockMode, ! keyMaterialSize, expandedKeyMaterialSize, effectiveKeyBytes, ! ivSize, blockSize) { } *************** *** 158,228 **** #region METHODS ! public RSACryptoServiceProvider CreateRSA(X509Certificate certificate) ! { ! RSAParameters rsaParams = new RSAParameters(); ! ! // for RSA m_publickey contains 2 ASN.1 integers ! // the modulus and the public exponent ! ASN1 pubkey = new ASN1(certificate.GetPublicKey()); ! ASN1 modulus = pubkey [0]; ! if ((modulus == null) || (modulus.Tag != 0x02)) ! { ! return null; ! } ! ASN1 exponent = pubkey [1]; ! if (exponent.Tag != 0x02) ! { ! return null; ! } ! ! rsaParams.Modulus = getUnsignedBigInteger(modulus.Value); ! rsaParams.Exponent = exponent.Value; ! ! return CreateRSA(rsaParams); ! } ! ! public RSACryptoServiceProvider CreateRSA(RSAParameters rsaParams) ! { ! // BUG: MS BCL 1.0 can't import a key which ! // isn't the same size as the one present in ! // the container. ! int keySize = (rsaParams.Modulus.Length << 3); ! RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(keySize); ! rsa.ImportParameters(rsaParams); ! ! return rsa; ! } ! ! public void InitializeCipher() ! { ! createEncryptionCipher(); ! createDecryptionCipher(); ! } ! ! public void UpdateClientCipherIV(byte[] iv) ! { ! if (cipherMode == CipherMode.CBC) ! { ! // Set the new IV ! encryptionAlgorithm.IV = iv; ! ! // Create encryption cipher with the new IV ! encryptionCipher = encryptionAlgorithm.CreateEncryptor(); ! } ! } ! ! public void UpdateServerCipherIV(byte[] iv) ! { ! if (cipherMode == CipherMode.CBC) ! { ! // Set the new IV ! decryptionAlgorithm.IV = iv; ! ! // Create encryption cipher with the new IV ! decryptionCipher = decryptionAlgorithm.CreateDecryptor(); ! } ! } ! ! public byte[] EncryptRecord(byte[] fragment, byte[] mac) { // Encryption ( fragment + mac [+ padding + padding_length] ) --- 52,56 ---- #region METHODS ! public override byte[] EncryptRecord(byte[] fragment, byte[] mac) { // Encryption ( fragment + mac [+ padding + padding_length] ) *************** *** 236,240 **** // Calculate padding_length int fragmentLength = fragment.Length + mac.Length + 1; ! int paddingLength = (((fragmentLength/blockSize)*8) + blockSize) - fragmentLength; // Write padding length byte --- 64,68 ---- // Calculate padding_length int fragmentLength = fragment.Length + mac.Length + 1; ! int paddingLength = (((fragmentLength/blockSize)*blockSize) + blockSize) - fragmentLength; // Write padding length byte *************** *** 247,251 **** } ! public void DecryptRecord(byte[] fragment, ref byte[] dcrFragment, ref byte[] dcrMAC) { int fragmentSize = 0; --- 75,79 ---- } ! public override void DecryptRecord(byte[] fragment, ref byte[] dcrFragment, ref byte[] dcrMAC) { int fragmentSize = 0; *************** *** 284,383 **** } - public int GetKeyBlockSize() - { - return keyMaterialSize*2 + HashSize*2 + ivSize*2; - } - #endregion ! #region PRIVATE_METHODS ! // This code is from Mono.Security.X509Certificate class. ! private byte[] getUnsignedBigInteger(byte[] integer) { ! if (integer[0] == 0x00) ! { ! // this first byte is added so we're sure it's an unsigned integer ! // however we can't feed it into RSAParameters or DSAParameters ! int length = integer.Length - 1; ! byte[] uinteger = new byte[length]; ! Array.Copy(integer, 1, uinteger, 0, length); ! return uinteger; ! } ! else ! { ! return integer; ! } } ! private void createEncryptionCipher() { ! // Create and configure the symmetric algorithm ! switch (this.algName) ! { ! case "RC4": ! encryptionAlgorithm = new ARC4Managed(); ! break; ! ! default: ! encryptionAlgorithm = SymmetricAlgorithm.Create(algName); ! break; ! } ! // If it's a block cipher ! if (cipherMode == CipherMode.CBC) ! { ! // Configure encrypt algorithm ! encryptionAlgorithm.Mode = this.cipherMode; ! encryptionAlgorithm.Padding = PaddingMode.PKCS7; ! encryptionAlgorithm.KeySize = this.keyMaterialSize * 8; ! encryptionAlgorithm.BlockSize = this.blockSize * 8; ! } ! // Set the key and IV for the algorithm ! encryptionAlgorithm.Key = sessionContext.ClientWriteKey; ! encryptionAlgorithm.IV = sessionContext.ClientWriteIV; ! ! // Create encryption cipher ! encryptionCipher = encryptionAlgorithm.CreateEncryptor(); ! // Create the HMAC algorithm for the client ! clientHMAC = new HMAC(hashName, sessionContext.ClientWriteMAC); ! } ! private void createDecryptionCipher() ! { ! // Create and configure the symmetric algorithm ! switch (this.algName) { ! case "RC4": ! decryptionAlgorithm = new ARC4Managed(); ! break; ! ! default: ! decryptionAlgorithm = SymmetricAlgorithm.Create(algName); ! break; } ! ! // If it's a block cipher ! if (cipherMode == CipherMode.CBC) { ! // Configure encrypt algorithm ! decryptionAlgorithm.Mode = this.cipherMode; ! decryptionAlgorithm.Padding = PaddingMode.None; ! decryptionAlgorithm.KeySize = this.keyMaterialSize * 8; ! decryptionAlgorithm.BlockSize = this.blockSize * 8; ! } ! // Set the key and IV for the algorithm ! decryptionAlgorithm.Key = sessionContext.ServerWriteKey; ! decryptionAlgorithm.IV = sessionContext.ServerWriteIV; ! // Create decryption cipher ! decryptionCipher = decryptionAlgorithm.CreateDecryptor(); ! // Create the HMAC algorithm for the server ! serverHMAC = new HMAC(hashName, sessionContext.ServerWriteMAC); } --- 112,194 ---- } #endregion ! #region KEY_GENERATION_METODS ! public override void CreateMasterSecret(byte[] preMasterSecret) { ! TlsStream seed = new TlsStream(); ! // Seed ! seed.Write(context.ClientRandom); ! seed.Write(context.ServerRandom); ! ! // Create master secret ! context.MasterSecret = new byte[preMasterSecret.Length]; ! context.MasterSecret = PRF(preMasterSecret, "master secret", seed.ToArray(), 48); ! ! seed.Reset(); } ! public override void CreateKeys() { ! TlsStream seed = new TlsStream(); ! // Seed ! seed.Write(context.ServerRandom); ! seed.Write(context.ClientRandom); ! // Create keyblock ! TlsStream keyBlock = new TlsStream( ! PRF(this.Context.MasterSecret, ! "key expansion", ! seed.ToArray(), ! this.KeyBlockSize)); ! this.Context.ClientWriteMAC = keyBlock.ReadBytes(this.HashSize); ! this.Context.ServerWriteMAC = keyBlock.ReadBytes(this.HashSize); ! this.Context.ClientWriteKey = keyBlock.ReadBytes(this.KeyMaterialSize); ! this.Context.ServerWriteKey = keyBlock.ReadBytes(this.KeyMaterialSize); ! if (!this.IsExportable) { ! if (this.IvSize != 0) ! { ! this.Context.ClientWriteIV = keyBlock.ReadBytes(this.IvSize); ! this.Context.ServerWriteIV = keyBlock.ReadBytes(this.IvSize); ! } ! else ! { ! this.Context.ClientWriteIV = new byte[0]; ! this.Context.ServerWriteIV = new byte[0]; ! } } ! else { ! // Seed ! seed.Reset(); ! seed.Write(this.Context.ClientRandom); ! seed.Write(this.Context.ServerRandom); ! // Generate final write keys ! byte[] finalClientWriteKey = PRF(this.Context.ClientWriteKey, "client write key", seed.ToArray(), this.KeyMaterialSize); ! byte[] finalServerWriteKey = PRF(this.Context.ServerWriteKey, "server write key", seed.ToArray(), this.KeyMaterialSize); ! ! this.Context.ClientWriteKey = finalClientWriteKey; ! this.Context.ServerWriteKey = finalServerWriteKey; ! // Generate IV block ! byte[] ivBlock = PRF(new byte[]{}, "IV block", seed.ToArray(), this.IvSize*2); ! // Generate IV keys ! this.Context.ClientWriteIV = new byte[this.IvSize]; ! System.Array.Copy(ivBlock, 0, this.Context.ClientWriteIV, 0, this.Context.ClientWriteIV.Length); ! this.Context.ServerWriteIV = new byte[this.IvSize]; ! System.Array.Copy(ivBlock, this.IvSize, this.Context.ServerWriteIV, 0, this.Context.ServerWriteIV.Length); ! } ! ! // Clear no more needed data ! seed.Reset(); ! keyBlock.Reset(); } Index: TlsCipherSuiteCollection.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/TlsCipherSuiteCollection.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsCipherSuiteCollection.cs 11 Oct 2003 10:04:20 -0000 1.1 --- TlsCipherSuiteCollection.cs 20 Oct 2003 09:58:29 -0000 1.2 *************** *** 54,110 **** #endregion - #region STATIC_METHODS - - public static TlsCipherSuiteCollection GetSupportedCipherSuiteCollection() - { - TlsCipherSuiteCollection scs = new TlsCipherSuiteCollection(); - - // Supported ciphers - scs.Add((0x00 << 0x08) | 0x0A, "TLS_RSA_WITH_3DES_EDE_CBC_SHA", "3DES", "SHA", false, true, 24, 24, 168, 8, 8); - scs.Add((0x00 << 0x08) | 0x09, "TLS_RSA_WITH_DES_CBC_SHA", "DES", "SHA", false, true, 8, 8, 56, 8, 8); - scs.Add((0x00 << 0x08) | 0x05, "TLS_RSA_WITH_RC4_128_SHA", "RC4", "SHA", false, false, 16, 16, 128, 0, 0); - scs.Add((0x00 << 0x08) | 0x04, "TLS_RSA_WITH_RC4_128_MD5", "RC4", "MD5", false, false, 16, 16, 128, 0, 0); - - // Default CipherSuite - // scs.Add(0, "TLS_NULL_WITH_NULL_NULL", "", "", true, false, 0, 0, 0, 0, 0); - - // RSA Cipher Suites - // scs.Add((0x00 << 0x08) | 0x01, "TLS_RSA_WITH_NULL_MD5", "", "MD5", true, false, 0, 0, 0, 0, 0); - // scs.Add((0x00 << 0x08) | 0x02, "TLS_RSA_WITH_NULL_SHA", "", "SHA", true, false, 0, 0, 0, 0, 0); - // scs.Add((0x00 << 0x08) | 0x03, "TLS_RSA_EXPORT_WITH_RC4_40_MD5", "RC4", "MD5", true, false, 5, 16, 40, 0, 0); - // scs.Add((0x00 << 0x08) | 0x05, "TLS_RSA_WITH_RC4_128_SHA", "RC4", "SHA", false, false, 16, 16, 128, 0, 0); - // scs.Add((0x00 << 0x08) | 0x04, "TLS_RSA_WITH_RC4_128_MD5", "RC4", "MD5", false, false, 16, 16, 128, 0, 0); - // scs.Add((0x00 << 0x08) | 0x06, "TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5", "RC2", "MD5", true, true, 5, 16, 40, 8, 8); - // scs.Add((0x00 << 0x08) | 0x07, "TLS_RSA_WITH_IDEA_CBC_SHA", "IDEA", "SHA", false, true, 16, 16, 128, 8, 8); - // scs.Add((0x00 << 0x08) | 0x08, "TLS_RSA_EXPORT_WITH_DES40_CBC_SHA", "DES", "SHA", true, true, 5, 8, 40, 8, 8); - // scs.Add((0x00 << 0x08) | 0x09, "TLS_RSA_WITH_DES_CBC_SHA", "DES", "SHA", false, true, 8, 8, 56, 8, 8); - // scs.Add((0x00 << 0x08) | 0x0A, "TLS_RSA_WITH_3DES_EDE_CBC_SHA", "3DES", "SHA", false, true, 24, 24, 168, 8, 8); - - // Diffie-Hellman Cipher Suites - // scs.Add((0x00 << 0x08) | 0x0B, "TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA", "DES", "SHA", true, true, 5, 8, 40, 8, 8); - // scs.Add((0x00 << 0x08) | 0x0C, "TLS_DH_DSS_WITH_DES_CBC_SHA", "DES", "SHA", false, true, 8, 8, 56, 8, 8); - // scs.Add((0x00 << 0x08) | 0x0D, "TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA", "3DES", "SHA", false, true, 24, 24, 168, 8, 8); - // scs.Add((0x00 << 0x08) | 0x0E, "TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA", "DES", "SHA", true, true, 5, 8, 40, 8, 8); - // scs.Add((0x00 << 0x08) | 0x0F, "TLS_DH_RSA_WITH_DES_CBC_SHA", "DES", "SHA", false, true, 8, 8, 56, 8, 8); - // scs.Add((0x00 << 0x08) | 0x10, "TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA", "3DES", "SHA", false, true, 24, 24, 168, 8, 8); - // scs.Add((0x00 << 0x08) | 0x11, "TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA", "DES", "SHA", true, true, 5, 8, 40, 8, 8); - // scs.Add((0x00 << 0x08) | 0x12, "TLS_DHE_DSS_WITH_DES_CBC_SHA", "DES", "SHA", false, true, 8, 8, 56, 8, 8); - // scs.Add((0x00 << 0x08) | 0x13, "TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA", "3DES", "SHA", false, true, 24, 24, 168, 8, 8); - // scs.Add((0x00 << 0x08) | 0x14, "TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA", "DES", "SHA", true, true, 5, 8, 40, 8, 8); - // scs.Add((0x00 << 0x08) | 0x15, "TLS_DHE_RSA_WITH_DES_CBC_SHA", "SHA", "DES", false, true, 8, 8, 56, 8, 8); - // scs.Add((0x00 << 0x08) | 0x16, "TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA", "3DES", "SHA", false, true, 24, 24, 168, 8, 8); - - // Anonymous Diffie-Hellman Cipher Suites - // scs.Add((0x00 << 0x08) | 0x17, "TLS_DH_anon_EXPORT_WITH_RC4_40_MD5", "RC4", "MD5", true, false, 5, 16, 40, 0, 0); - // scs.Add((0x00 << 0x08) | 0x18, "TLS_DH_anon_WITH_RC4_128_MD5", "RC4", "MD5", false, false, 16, 16, 128, 0, 0); - // scs.Add((0x00 << 0x08) | 0x19, "TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA", "DES", "SHA", false, true, 5, 8, 40, 8, 8); - // scs.Add((0x00 << 0x08) | 0x1A, "TLS_DH_anon_WITH_DES_CBC_SHA", "DES4", "SHA", false, true, 8, 8, 56, 8, 8); - // scs.Add((0x00 << 0x08) | 0x1B, "TLS_DH_anon_WITH_3DES_EDE_CBC_SHA", "3DES", "SHA", false, true, 24, 24, 168, 8, 8); - - return scs; - } - - #endregion - #region METHODS --- 54,57 ---- *************** *** 154,158 **** } ! public TlsCipherSuite Add(short code, string name, string algName, string hashName, bool exportable, bool blockMode, byte keyMaterialSize, byte expandedKeyMaterialSize, byte effectiveKeyBytes, byte ivSize, byte blockSize) { TlsCipherSuite cipherSuite = new TlsCipherSuite(code, name, algName, hashName, exportable, blockMode, keyMaterialSize, expandedKeyMaterialSize, effectiveKeyBytes, ivSize, blockSize); --- 101,105 ---- } ! public TlsCipherSuite Add(short code, string name, string algName, string hashName, bool exportable, bool blockMode, byte keyMaterialSize, byte expandedKeyMaterialSize, short effectiveKeyBytes, byte ivSize, byte blockSize) { TlsCipherSuite cipherSuite = new TlsCipherSuite(code, name, algName, hashName, exportable, blockMode, keyMaterialSize, expandedKeyMaterialSize, effectiveKeyBytes, ivSize, blockSize); Index: TlsSession.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/TlsSession.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsSession.cs 13 Oct 2003 19:13:30 -0000 1.2 --- TlsSession.cs 20 Oct 2003 09:58:29 -0000 1.3 *************** *** 123,127 **** public TlsSession(TlsSessionSettings settings) { - this.supportedCiphers = TlsCipherSuiteCollection.GetSupportedCipherSuiteCollection(); this.settings = settings; this.context = new TlsSessionContext(); --- 123,126 ---- *************** *** 170,174 **** --- 169,175 ---- this.context.Protocol = settings.Protocol; this.state = TlsSessionState.OpeningSecure; + this.supportedCiphers = TlsCipherSuiteFactory.GetSupportedCiphers(context.Protocol); this.socket.DoHandshake(); + this.state = TlsSessionState.OpenSecure; } catch (TlsException ex) Index: TlsSessionContext.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/TlsSessionContext.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TlsSessionContext.cs 14 Oct 2003 10:13:58 -0000 1.4 --- TlsSessionContext.cs 20 Oct 2003 09:58:29 -0000 1.5 *************** *** 192,207 **** #endregion ! #region KEY_GENERATION_METODS ! ! public byte[] GetSecureRandomBytes(int count) ! { ! byte[] secureBytes = new byte[count]; ! ! RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider(); ! rng.GetNonZeroBytes(secureBytes); ! ! return secureBytes; ! } ! public int GetUnixTime() { --- 192,197 ---- #endregion ! #region METHODS ! public int GetUnixTime() { *************** *** 212,387 **** } ! public byte[] CreatePremasterSecret() ! { ! TlsStream stream = new TlsStream(); ! ! // Write protocol version ! stream.Write((short)protocol); ! ! // Generate random bytes ! stream.Write(GetSecureRandomBytes(46)); ! ! byte[] preMasterSecret = stream.ToArray(); ! ! stream.Reset(); ! ! return preMasterSecret; ! } ! ! public void CreateMasterSecret(byte[] preMasterSecret) ! { ! TlsCipherSuite cipherSuite = cipher; ! TlsStream seed = new TlsStream(); ! ! // Seed ! seed.Write(clientRandom); ! seed.Write(serverRandom); ! ! // Create master secret ! masterSecret = new byte[preMasterSecret.Length]; ! masterSecret = PRF(preMasterSecret, "master secret", seed.ToArray(), 48); ! ! seed.Reset(); ! } ! ! public void CreateKeys() ! { ! TlsStream seed = new TlsStream(); ! ! // Seed ! seed.Write(serverRandom); ! seed.Write(clientRandom); ! ! // Create keyblock ! TlsStream keyBlock = new TlsStream( ! PRF(masterSecret, ! "key expansion", ! seed.ToArray(), ! cipher.GetKeyBlockSize())); ! ! clientWriteMAC = keyBlock.ReadBytes(cipher.HashSize); ! serverWriteMAC = keyBlock.ReadBytes(cipher.HashSize); ! clientWriteKey = keyBlock.ReadBytes(cipher.KeyMaterialSize); ! serverWriteKey = keyBlock.ReadBytes(cipher.KeyMaterialSize); ! ! if (!cipher.IsExportable) ! { ! if (cipher.IvSize != 0) ! { ! clientWriteIV = keyBlock.ReadBytes(cipher.IvSize); ! serverWriteIV = keyBlock.ReadBytes(cipher.IvSize); ! } ! else ! { ! clientWriteIV = new byte[0]; ! serverWriteIV = new byte[0]; ! } ! } ! else ! { ! // Seed ! seed.Reset(); ! seed.Write(clientRandom); ! seed.Write(serverRandom); ! ! // Generate final write keys ! byte[] finalClientWriteKey = PRF(clientWriteKey, "client write key", seed.ToArray(), cipher.KeyMaterialSize); ! byte[] finalServerWriteKey = PRF(serverWriteKey, "server write key", seed.ToArray(), cipher.KeyMaterialSize); ! ! clientWriteKey = finalClientWriteKey; ! serverWriteKey = finalServerWriteKey; ! ! // Generate IV block ! byte[] ivBlock = PRF(new byte[]{}, "IV block", seed.ToArray(), cipher.IvSize*2); ! ! // Generate IV keys ! clientWriteIV = new byte[cipher.IvSize]; ! System.Array.Copy(ivBlock, 0, clientWriteIV, 0, clientWriteIV.Length); ! serverWriteIV = new byte[cipher.IvSize]; ! System.Array.Copy(ivBlock, cipher.IvSize, serverWriteIV, 0, serverWriteIV.Length); ! } ! ! // Clear no more needed data ! seed.Reset(); ! keyBlock.Reset(); ! } ! ! public byte[] PRF(byte[] secret, string label, byte[] data, int length) ! { ! MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider(); ! SHA1CryptoServiceProvider sha1 = new SHA1CryptoServiceProvider(); ! ! int secretLen = secret.Length / 2; ! ! // Seed ! TlsStream seedStream = new TlsStream(); ! seedStream.Write(Encoding.ASCII.GetBytes(label)); ! seedStream.Write(data); ! byte[] seed = seedStream.ToArray(); ! seedStream.Reset(); ! ! // Secret 1 ! byte[] secret1 = new byte[secretLen]; ! System.Array.Copy(secret, 0, secret1, 0, secretLen); ! ! // Secret2 ! byte[] secret2 = new byte[secretLen]; ! System.Array.Copy(secret, secretLen, secret2, 0, secretLen); ! ! // Secret 1 processing ! byte[] p_md5 = Expand("MD5", secret1, seed, length); ! ! // Secret 2 processing ! byte[] p_sha = Expand("SHA1", secret2, seed, length); ! ! // Perfor XOR of both results ! byte[] masterSecret = new byte[length]; ! for (int i = 0; i < masterSecret.Length; i++) ! { ! masterSecret[i] = (byte)(p_md5[i] ^ p_sha[i]); ! } ! ! return masterSecret; ! } ! ! public byte[] Expand(string hashName, byte[] secret, byte[] seed, int length) { ! int hashLength = hashName == "MD5" ? 16 : 20; ! int iterations = (int)(length / hashLength); ! if ((length % hashLength) > 0) ! { ! iterations++; ! } ! ! HMAC hmac = new HMAC(hashName, secret); ! TlsStream resMacs = new TlsStream(); ! ! byte[][] hmacs = new byte[iterations + 1][]; ! hmacs[0] = seed; ! for (int i = 1; i <= iterations; i++) ! { ! TlsStream hcseed = new TlsStream(); ! hmac.TransformFinalBlock(hmacs[i-1], 0, hmacs[i-1].Length); ! hmacs[i] = hmac.Hash; ! hcseed.Write(hmacs[i]); ! hcseed.Write(seed); ! hmac.TransformFinalBlock(hcseed.ToArray(), 0, (int)hcseed.Length); ! resMacs.Write(hmac.Hash); ! hcseed.Reset(); ! } ! byte[] res = new byte[length]; ! System.Array.Copy(resMacs.ToArray(), 0, res, 0, res.Length); ! ! resMacs.Reset(); ! ! return res; } - #endregion - - #region METHODS - public void ClearKeyInfo() { --- 202,215 ---- } ! public byte[] GetSecureRandomBytes(int count) { ! byte[] secureBytes = new byte[count]; ! RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider(); ! rng.GetNonZeroBytes(secureBytes); ! return secureBytes; } public void ClearKeyInfo() { |
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls In directory sc8-pr-cvs1:/tmp/cvs-serv29698 Added Files: TlsAbstractCipherSuite.cs TlsCipherSuiteFactory.cs TlsSslCipherSuite.cs Log Message: * TLS implementation: - Fixed padding length calculation on record encryption. - Abstracted CipherSuite classes for allow work with other protocol versions. - Added new files : TlsAbstractCipherSuite.cs TlsSslCipherSuite.cs TlsCipherSuiteFactory.cs - Added new cipher suites definitions based on RFC3268 - (http://www.ietf.org/rfc/rfc3268.txt) - Added two new supported ciphersuites for TLS protocol: TLS_RSA_WITH_AES_256_CBC_SHA TLS_RSA_WITH_AES_128_CBC_SHA - Moved key generation stuff to specific cipher suite classes. --- NEW FILE: TlsAbstractCipherSuite.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsCipherSuiteFactory.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsSslCipherSuite.cs --- (This appears to be a binary file; contents omitted.) |
|
From: <car...@us...> - 2003-10-20 11:37:36
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10 In directory sc8-pr-cvs1:/tmp/cvs-serv30039 Modified Files: changelog.txt Log Message: Updated CHANGELOG.TXT Index: changelog.txt =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/changelog.txt,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** changelog.txt 19 Oct 2003 14:09:15 -0000 1.51 --- changelog.txt 20 Oct 2003 10:01:55 -0000 1.52 *************** *** 3,6 **** --- 3,33 ---- + 2003-10-20 Carlos Guzmán Álvarez <car...@te...> + + * TLS implementation: + + - Fixed padding length calculation on record encryption. + + - Abstracted CipherSuite classes for allow work with other protocol versions. + + - Added new files : + + TlsAbstractCipherSuite.cs + + TlsSslCipherSuite.cs + + TlsCipherSuiteFactory.cs + + - Added new cipher suites definitions based on RFC3268 - (http://www.ietf.org/rfc/rfc3268.txt) + + - Added two new supported ciphersuites for TLS protocol: + + TLS_RSA_WITH_AES_256_CBC_SHA + + TLS_RSA_WITH_AES_128_CBC_SHA + + - Moved key generation stuff to specific cipher suite classes. + + 2003-10-19 Carlos Guzmán Álvarez <car...@te...> |
|
From: <car...@us...> - 2003-10-20 11:32:38
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake/Mono.Security.Protocol.Tls.Handshake.Client In directory sc8-pr-cvs1:/tmp/cvs-serv29957 Modified Files: TlsClientFinished.cs TlsClientHello.cs TlsClientKeyExchange.cs TlsServerFinished.cs TlsServerHello.cs Log Message: * TLS implementation: - Fixed padding length calculation on record encryption. - Abstracted CipherSuite classes for allow work with other protocol versions. - Added new files : TlsAbstractCipherSuite.cs TlsSslCipherSuite.cs TlsCipherSuiteFactory.cs - Added new cipher suites definitions based on RFC3268 - (http://www.ietf.org/rfc/rfc3268.txt) - Added two new supported ciphersuites for TLS protocol: TLS_RSA_WITH_AES_256_CBC_SHA TLS_RSA_WITH_AES_128_CBC_SHA - Moved key generation stuff to specific cipher suite classes. Index: TlsClientFinished.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientFinished.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TlsClientFinished.cs 16 Oct 2003 14:25:57 -0000 1.4 --- TlsClientFinished.cs 20 Oct 2003 10:01:19 -0000 1.5 *************** *** 65,69 **** // Write message contents ! Write(Session.Context.PRF(Session.Context.MasterSecret, "client finished", hashes.ToArray(), 12)); // Reset data --- 65,69 ---- // Write message contents ! Write(Session.Context.Cipher.PRF(Session.Context.MasterSecret, "client finished", hashes.ToArray(), 12)); // Reset data Index: TlsClientHello.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TlsClientHello.cs 16 Oct 2003 14:25:57 -0000 1.4 --- TlsClientHello.cs 20 Oct 2003 10:01:19 -0000 1.5 *************** *** 70,79 **** { // Client Version ! Write((short)Session.Context.Protocol); // Random bytes - Unix time + Radom bytes [28] TlsStream clientRandom = new TlsStream(); ! clientRandom.Write(Session.Context.GetUnixTime()); ! clientRandom.Write(Session.Context.GetSecureRandomBytes(28)); this.random = clientRandom.ToArray(); clientRandom.Reset(); --- 70,79 ---- { // Client Version ! Write((short)this.Session.Context.Protocol); // Random bytes - Unix time + Radom bytes [28] TlsStream clientRandom = new TlsStream(); ! clientRandom.Write(this.Session.Context.GetUnixTime()); ! clientRandom.Write(this.Session.Context.GetSecureRandomBytes(28)); this.random = clientRandom.ToArray(); clientRandom.Reset(); *************** *** 83,92 **** // Session id // Send the session ID empty ! if (Session.SessionId != null) { ! Write((byte)Session.SessionId.Length); ! if (Session.SessionId.Length > 0) { ! Write(Session.SessionId); } } --- 83,92 ---- // Session id // Send the session ID empty ! if (this.Session.SessionId != null) { ! Write((byte)this.Session.SessionId.Length); ! if (this.Session.SessionId.Length > 0) { ! Write(this.Session.SessionId); } } *************** *** 97,106 **** // Write length of Cipher suites ! Write((short)(Session.SupportedCiphers.Count*2)); // Write Supported Cipher suites ! for (int i = 0; i < Session.SupportedCiphers.Count; i++) { ! Write((short)Session.SupportedCiphers[i].Code); } --- 97,106 ---- // Write length of Cipher suites ! Write((short)(this.Session.SupportedCiphers.Count*2)); // Write Supported Cipher suites ! for (int i = 0; i < this.Session.SupportedCiphers.Count; i++) { ! Write((short)this.Session.SupportedCiphers[i].Code); } Index: TlsClientKeyExchange.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientKeyExchange.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TlsClientKeyExchange.cs 16 Oct 2003 14:25:57 -0000 1.3 --- TlsClientKeyExchange.cs 20 Oct 2003 10:01:19 -0000 1.4 *************** *** 52,56 **** { // Compute pre master secret ! byte[] preMasterSecret = Session.Context.CreatePremasterSecret(); // Create a new RSA key --- 52,56 ---- { // Compute pre master secret ! byte[] preMasterSecret = Session.Context.Cipher.CreatePremasterSecret(); // Create a new RSA key *************** *** 74,81 **** // Create master secret ! Session.Context.CreateMasterSecret(preMasterSecret); // Create keys ! Session.Context.CreateKeys(); // Clear resources --- 74,81 ---- // Create master secret ! Session.Context.Cipher.CreateMasterSecret(preMasterSecret); // Create keys ! Session.Context.Cipher.CreateKeys(); // Clear resources Index: TlsServerFinished.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerFinished.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TlsServerFinished.cs 16 Oct 2003 14:25:57 -0000 1.5 --- TlsServerFinished.cs 20 Oct 2003 10:01:19 -0000 1.6 *************** *** 65,69 **** hashes.Write(Session.Context.HandshakeHashes.GetSHAHash()); ! byte[] clientPRF = Session.Context.PRF(Session.Context.MasterSecret, "server finished", hashes.ToArray(), 12); hashes.Reset(); --- 65,69 ---- hashes.Write(Session.Context.HandshakeHashes.GetSHAHash()); ! byte[] clientPRF = Session.Context.Cipher.PRF(Session.Context.MasterSecret, "server finished", hashes.ToArray(), 12); hashes.Reset(); Index: TlsServerHello.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHello.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TlsServerHello.cs 16 Oct 2003 14:25:57 -0000 1.4 --- TlsServerHello.cs 20 Oct 2003 10:01:19 -0000 1.5 *************** *** 58,62 **** Session.Context.Cipher = this.cipherSuite; Session.Context.CompressionMethod = this.compressionMethod; ! Session.Context.Cipher.SessionState = Session.Context; } --- 58,62 ---- Session.Context.Cipher = this.cipherSuite; Session.Context.CompressionMethod = this.compressionMethod; ! Session.Context.Cipher.Context = this.Session.Context; } *************** *** 73,80 **** { // Read protocol version ! this.protocol = (TlsProtocol)ReadInt16(); // Read random - Unix time + Random bytes ! this.random = ReadBytes(32); // Read Session id --- 73,80 ---- { // Read protocol version ! this.protocol = (TlsProtocol)this.ReadInt16(); // Read random - Unix time + Random bytes ! this.random = this.ReadBytes(32); // Read Session id *************** *** 82,99 **** if (length > 0) { ! this.sessionId = ReadBytes(length); } // Read cipher suite ! short cipherCode = ReadInt16(); ! if (Session.SupportedCiphers.IndexOf(cipherCode) == -1) { // The server has sent an invalid ciphersuite throw new TlsException("Invalid cipher suite received from server"); } ! cipherSuite = Session.SupportedCiphers[cipherCode]; // Read compression methods ( always 0 ) ! compressionMethod = ReadByte(); } --- 82,99 ---- if (length > 0) { ! this.sessionId = this.ReadBytes(length); } // Read cipher suite ! short cipherCode = this.ReadInt16(); ! if (this.Session.SupportedCiphers.IndexOf(cipherCode) == -1) { // The server has sent an invalid ciphersuite throw new TlsException("Invalid cipher suite received from server"); } ! this.cipherSuite = this.Session.SupportedCiphers[cipherCode]; // Read compression methods ( always 0 ) ! this.compressionMethod = this.ReadByte(); } |
|
From: <car...@us...> - 2003-10-19 15:08:39
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient
In directory sc8-pr-cvs1:/tmp/cvs-serv20171
Modified Files:
PgDbClient.cs PgResponsePacket.cs PgType.cs
Log Message:
- Added support for unidimensional arrays of Geometric Types.
- Addes upport for boolean arrays.
Index: PgDbClient.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgDbClient.cs,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** PgDbClient.cs 18 Oct 2003 19:14:43 -0000 1.26
--- PgDbClient.cs 19 Oct 2003 14:08:22 -0000 1.27
***************
*** 677,680 ****
--- 677,681 ----
types.Add(829 , "macaddr" , PgDataType.VarChar , 0, 0, 6);
types.Add(869 , "inet" , PgDataType.VarChar , 0, 0, 0);
+ types.Add(1000 , "_bool" , PgDataType.Array , 16, 1, 1);
types.Add(1005 , "_int2" , PgDataType.Array , 21, 1, 2);
types.Add(1007 , "_int4" , PgDataType.Array , 23, 1, 4);
Index: PgResponsePacket.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgResponsePacket.cs,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** PgResponsePacket.cs 18 Oct 2003 14:46:26 -0000 1.13
--- PgResponsePacket.cs 19 Oct 2003 14:08:22 -0000 1.14
***************
*** 149,164 ****
}
! public int ReadInt()
{
! int val = base.ReadInt32();
return IPAddress.HostToNetworkOrder(val);
}
! public short ReadShort()
{
! short val = base.ReadInt16();
! return IPAddress.HostToNetworkOrder(val);
}
--- 149,164 ----
}
! public short ReadShort()
{
! short val = base.ReadInt16();
return IPAddress.HostToNetworkOrder(val);
}
! public int ReadInt()
{
! int val = base.ReadInt32();
! return IPAddress.HostToNetworkOrder(val);
}
***************
*** 224,283 ****
}
! public Array ReadPrimitiveArray(PgType type, int length)
{
! PgType elementType = type;
! Array data = null;
!
! int[] lengths;
! int[] lowerBounds;
!
! // Read te number of dimensions
! int ndims = ReadInt();
!
! lengths = new int[ndims];
! lowerBounds = new int[ndims];
!
! int flags = ReadInt();
! if (flags != 0)
{
! throw new NotSupportedException("Invalid flags value");
}
! // Read array element type
! elementType = PgDbClient.Types[ReadInt()];
! // Read array lengths and lower bounds
! for (int i = 0; i < ndims; i++)
{
! lengths[i] = ReadInt();
! lowerBounds[i] = ReadInt();
! }
!
! data = Array.CreateInstance(elementType.SystemType, lengths, lowerBounds);
!
! // Read array data
! byte[] sourceArray = decodeArrayData(elementType, data.Length, length);
!
! Buffer.BlockCopy(sourceArray, 0, data, 0, sourceArray.Length);
!
! return data;
! }
!
! public Array ReadStringArray(PgType type, int length)
! {
! PgType elementType = PgDbClient.Types[type.ElementType];
! Array data = null;
! string contents = ReadString(length);
! contents = contents.Substring(1, contents.Length - 2);
! string[] elements = contents.Split(',');
! data = Array.CreateInstance(elementType.SystemType, elements.Length);
! for (int i = 0; i < elements.Length; i++)
! {
! data.SetValue(elements[i], i);
}
-
- return data;
}
--- 224,274 ----
}
! public Array ReadArray(PgType type, int length)
{
! if (type.FormatCode == 0)
{
! return this.readStringArray(type, length);
}
! else
{
! int[] lengths;
! int[] lowerBounds;
! // Read number of dimensions
! int dimensions = this.ReadInt();
!
! // Initialize arrays for lengths and lower bounds
! lengths = new int[dimensions];
! lowerBounds = new int[dimensions];
! // Read flags value
! int flags = this.ReadInt();
! if (flags != 0)
! {
! throw new NotSupportedException("Invalid flags value");
! }
!
! // Read array element type
! PgType elementType = PgDbClient.Types[this.ReadInt()];
! // Read array lengths and lower bounds
! for (int i = 0; i < dimensions; i++)
! {
! lengths[i] = this.ReadInt();
! lowerBounds[i] = this.ReadInt();
! }
! // Read Array data
! if (type.SystemType.IsPrimitive)
! {
! return this.readPrimitiveArray(elementType, length,
! dimensions, flags, lengths, lowerBounds);
! }
! else
! {
! return this.readNonPrimitiveArray(elementType, length,
! dimensions, flags, lengths, lowerBounds);
! }
}
}
***************
*** 353,357 ****
}
! // Common read method
public object ReadValue(PgType type, int length)
--- 344,350 ----
}
! #endregion
!
! #region READ_VALUE
public object ReadValue(PgType type, int length)
***************
*** 360,371 ****
{
case PgDataType.Array:
! if (type.FormatCode == 0)
! {
! return this.ReadStringArray(type, length);
! }
! else
! {
! return this.ReadPrimitiveArray(type, length);
! }
case PgDataType.Vector:
--- 353,357 ----
{
case PgDataType.Array:
! return this.ReadArray(type, length);
case PgDataType.Vector:
***************
*** 444,448 ****
#endregion
! #region PRIVATE_METHODS
private byte[] decodeArrayData(PgType type, int elementCount, int length)
--- 430,481 ----
#endregion
! #region ARRAY_METHODS
!
! private Array readPrimitiveArray(PgType elementType, int length,
! int dimensions, int flags, int[] lengths, int[] lowerBounds)
! {
! Array data = Array.CreateInstance(elementType.SystemType, lengths, lowerBounds);
!
! // Read array data
! byte[] sourceArray = decodeArrayData(elementType, data.Length, length);
!
! Buffer.BlockCopy(sourceArray, 0, data, 0, sourceArray.Length);
!
! return data;
! }
!
! private Array readNonPrimitiveArray(PgType elementType, int length,
! int dimensions, int flags, int[] lengths, int[] lowerBounds)
! {
! Array data = Array.CreateInstance(elementType.SystemType, lengths, lowerBounds);
!
! for (int i = data.GetLowerBound(0); i <= data.GetUpperBound(0); i++)
! {
! int elementLen = this.ReadInt();
! data.SetValue(this.ReadValue(elementType, elementType.Size), i);
! }
!
! return data;
! }
!
! private Array readStringArray(PgType type, int length)
! {
! PgType elementType = PgDbClient.Types[type.ElementType];
! Array data = null;
!
! string contents = ReadString(length);
! contents = contents.Substring(1, contents.Length - 2);
!
! string[] elements = contents.Split(',');
!
! data = Array.CreateInstance(elementType.SystemType, elements.Length);
!
! for (int i = 0; i < elements.Length; i++)
! {
! data.SetValue(elements[i], i);
! }
!
! return data;
! }
private byte[] decodeArrayData(PgType type, int elementCount, int length)
***************
*** 453,488 ****
int index = 0;
while (element < elementCount)
! {
byte[] elementData = null;
! int elementLen = ReadInt();
switch (type.DataType)
{
case PgDataType.Boolean:
! elementData = BitConverter.GetBytes(ReadBoolean());
! break;
!
! case PgDataType.Byte:
! elementData = BitConverter.GetBytes(ReadByte());
break;
case PgDataType.Float:
! elementData = BitConverter.GetBytes(ReadSingle());
break;
case PgDataType.Double:
! elementData = BitConverter.GetBytes(ReadDouble());
break;
case PgDataType.Int2:
! elementData = BitConverter.GetBytes(ReadShort());
break;
case PgDataType.Int4:
! elementData = BitConverter.GetBytes(ReadInt());
break;
case PgDataType.Int8:
! elementData = BitConverter.GetBytes(ReadLong());
break;
}
--- 486,517 ----
int index = 0;
while (element < elementCount)
! {
byte[] elementData = null;
! int elementLen = this.ReadInt();
switch (type.DataType)
{
case PgDataType.Boolean:
! elementData = BitConverter.GetBytes(this.ReadBoolean());
break;
case PgDataType.Float:
! elementData = BitConverter.GetBytes(this.ReadSingle());
break;
case PgDataType.Double:
! elementData = BitConverter.GetBytes(this.ReadDouble());
break;
case PgDataType.Int2:
! elementData = BitConverter.GetBytes(this.ReadShort());
break;
case PgDataType.Int4:
! elementData = BitConverter.GetBytes(this.ReadInt());
break;
case PgDataType.Int8:
! elementData = BitConverter.GetBytes(this.ReadLong());
break;
}
Index: PgType.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgType.cs,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** PgType.cs 18 Oct 2003 19:14:43 -0000 1.6
--- PgType.cs 19 Oct 2003 14:08:22 -0000 1.7
***************
*** 150,160 ****
case PgDataType.Box:
case PgDataType.Circle:
case PgDataType.Line:
case PgDataType.LSeg:
case PgDataType.Path:
case PgDataType.Point:
case PgDataType.Polygon:
! return Type.GetType("System.Object");
case PgDataType.Byte:
--- 150,172 ----
case PgDataType.Box:
+ return Type.GetType("PostgreSql.Data.PgTypes.PgBox");
+
case PgDataType.Circle:
+ return Type.GetType("PostgreSql.Data.PgTypes.PgCircle");
+
case PgDataType.Line:
+ return Type.GetType("PostgreSql.Data.PgTypes.PgLine");
+
case PgDataType.LSeg:
+ return Type.GetType("PostgreSql.Data.PgTypes.PgLSeg");
+
case PgDataType.Path:
+ return Type.GetType("PostgreSql.Data.PgTypes.PgPath");
+
case PgDataType.Point:
+ return Type.GetType("PostgreSql.Data.PgTypes.PgPoint");
+
case PgDataType.Polygon:
! return Type.GetType("PostgreSql.Data.PgTypes.PgPolygon");
case PgDataType.Byte:
|
|
From: <car...@us...> - 2003-10-19 15:05:41
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10 In directory sc8-pr-cvs1:/tmp/cvs-serv20299 Modified Files: changelog.txt Log Message: Updated CHANGELOG.TXT Index: changelog.txt =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/changelog.txt,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** changelog.txt 18 Oct 2003 19:15:41 -0000 1.50 --- changelog.txt 19 Oct 2003 14:09:15 -0000 1.51 *************** *** 2,5 **** --- 2,15 ---- ------------------------------------------------------- + + 2003-10-19 Carlos Guzmán Álvarez <car...@te...> + + * Protocol implementation: + + - Added support for unidimensional arrays of Geometric Types. + + - Addes upport for boolean arrays. + + 2003-10-18 Carlos Guzmán Álvarez <car...@te...> |
|
From: <car...@us...> - 2003-10-19 09:07:45
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient
In directory sc8-pr-cvs1:/tmp/cvs-serv31173
Modified Files:
PgOutputPacket.cs PgResponsePacket.cs
Log Message:
- Added specific classes for handle Postgres Geometric types
- Added handling of line and lseg postgres types
Index: PgOutputPacket.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgOutputPacket.cs,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** PgOutputPacket.cs 17 Oct 2003 20:47:55 -0000 1.10
--- PgOutputPacket.cs 18 Oct 2003 11:58:13 -0000 1.11
***************
*** 24,27 ****
--- 24,29 ----
using System.Globalization;
+ using PostgreSql.Data.PgTypes;
+
namespace PostgreSql.Data.NPgClient
{
***************
*** 66,69 ****
--- 68,73 ----
#region WRITE_METHODS
+ // Standard types
+
public void WriteString(string data)
{
***************
*** 142,145 ****
--- 146,177 ----
}
+ // Geometric types
+
+ public void WritePoint(PgPoint point)
+ {
+ WriteDouble(point.X);
+ WriteDouble(point.Y);
+ }
+
+ public void WriteCircle(PgCircle circle)
+ {
+ WritePoint(circle.Center);
+ WriteDouble(circle.Radius);
+ }
+
+ public void WriteLine(PgLine line)
+ {
+ WritePoint(line.StartPoint);
+ WritePoint(line.EndPoint);
+ }
+
+ public void WriteLSeg(PgLSeg lseg)
+ {
+ WritePoint(lseg.StartPoint);
+ WritePoint(lseg.EndPoint);
+ }
+
+ // Parameters
+
public void WriteParameter(PgParameter parameter)
{
***************
*** 283,305 ****
case PgDataType.Point:
! double[] point = (double[])value;
packet.WriteInt(size);
! packet.WriteDouble(point[0]); // x
! packet.WriteDouble(point[1]); // y
break;
case PgDataType.Circle:
! double[] circle = (double[])value;
packet.WriteInt(size);
! packet.WriteDouble(circle[0]); // x
! packet.WriteDouble(circle[1]); // y
! packet.WriteDouble(circle[2]); // r
break;
- case PgDataType.Box:
case PgDataType.Line:
case PgDataType.LSeg:
case PgDataType.Path:
--- 315,346 ----
case PgDataType.Point:
! PgPoint point = value as PgPoint;
packet.WriteInt(size);
! packet.WritePoint(point);
break;
case PgDataType.Circle:
! PgCircle circle = value as PgCircle;
packet.WriteInt(size);
! packet.WriteCircle(circle);
break;
case PgDataType.Line:
+ PgLine line = value as PgLine;
+
+ packet.WriteInt(size);
+ packet.WriteLine(line);
+ break;
+
case PgDataType.LSeg:
+ PgLSeg lseg = value as PgLSeg;
+
+ packet.WriteInt(size);
+ packet.WriteLSeg(lseg);
+ break;
+
+ case PgDataType.Box:
case PgDataType.Path:
Index: PgResponsePacket.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgResponsePacket.cs,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** PgResponsePacket.cs 17 Oct 2003 20:47:55 -0000 1.9
--- PgResponsePacket.cs 18 Oct 2003 11:58:13 -0000 1.10
***************
*** 24,27 ****
--- 24,29 ----
using System.Net;
+ using PostgreSql.Data.PgTypes;
+
namespace PostgreSql.Data.NPgClient
{
***************
*** 293,313 ****
// Geometric datatypes methods
! public double[] ReadPoint()
{
! double x = ReadDouble();
! double y = ReadDouble();
! return new double[]{x, y};
}
! public double[] ReadCircle()
{
! double x = ReadDouble();
! double y = ReadDouble();
! double r = ReadDouble();
! return new double[]{x, y, r};
}
public object ReadValue(PgType type, int length)
{
--- 295,323 ----
// Geometric datatypes methods
! public PgPoint ReadPoint()
{
! double x = this.ReadDouble();
! double y = this.ReadDouble();
! return new PgPoint(x, y);
}
! public PgCircle ReadCircle()
{
! return new PgCircle(this.ReadPoint(), this.ReadDouble());
! }
! public PgLine ReadLine()
! {
! return new PgLine(this.ReadPoint(), this.ReadPoint());
}
+ public PgLSeg ReadLSeg()
+ {
+ return new PgLSeg(this.ReadPoint(), this.ReadPoint());
+ }
+
+ // Common read method
+
public object ReadValue(PgType type, int length)
{
***************
*** 317,382 ****
if (type.FormatCode == 0)
{
! return ReadStringArray(type, length);
}
else
{
! return ReadPrimitiveArray(type, length);
}
case PgDataType.Vector:
! return ReadVector(type, length);
case PgDataType.Binary:
! return ReadBytes(length);
case PgDataType.Char:
case PgDataType.VarChar:
! return ReadString(length);
case PgDataType.Boolean:
! return ReadBoolean();
case PgDataType.Byte:
! return ReadByte();
case PgDataType.Decimal:
! string numericValue = ReadString(length);
return Decimal.Parse(numericValue, NumberFormatInfo.InvariantInfo);
case PgDataType.Currency:
! return ReadCurrency();
case PgDataType.Float:
! return ReadSingle();
case PgDataType.Double:
! return ReadDouble();
case PgDataType.Int2:
! return ReadShort();
case PgDataType.Int4:
! return ReadInt();
case PgDataType.Int8:
! return ReadLong();
case PgDataType.Date:
! return ReadDate();
case PgDataType.Time:
! return ReadTime();
case PgDataType.TimeStamp:
! return ReadTimestamp();
case PgDataType.Point:
! return ReadPoint();
case PgDataType.Circle:
! return ReadCircle();
case PgDataType.Line:
case PgDataType.LSeg:
case PgDataType.Box:
case PgDataType.Path:
--- 327,396 ----
if (type.FormatCode == 0)
{
! return this.ReadStringArray(type, length);
}
else
{
! return this.ReadPrimitiveArray(type, length);
}
case PgDataType.Vector:
! return this.ReadVector(type, length);
case PgDataType.Binary:
! return this.ReadBytes(length);
case PgDataType.Char:
case PgDataType.VarChar:
! return this.ReadString(length);
case PgDataType.Boolean:
! return this.ReadBoolean();
case PgDataType.Byte:
! return this.ReadByte();
case PgDataType.Decimal:
! string numericValue = this.ReadString(length);
return Decimal.Parse(numericValue, NumberFormatInfo.InvariantInfo);
case PgDataType.Currency:
! return this.ReadCurrency();
case PgDataType.Float:
! return this.ReadSingle();
case PgDataType.Double:
! return this.ReadDouble();
case PgDataType.Int2:
! return this.ReadShort();
case PgDataType.Int4:
! return this.ReadInt();
case PgDataType.Int8:
! return this.ReadLong();
case PgDataType.Date:
! return this.ReadDate();
case PgDataType.Time:
! return this.ReadTime();
case PgDataType.TimeStamp:
! return this.ReadTimestamp();
case PgDataType.Point:
! return this.ReadPoint();
case PgDataType.Circle:
! return this.ReadCircle();
case PgDataType.Line:
+ return this.ReadLine();
+
case PgDataType.LSeg:
+ return this.ReadLSeg();
+
case PgDataType.Box:
case PgDataType.Path:
|
|
From: <car...@us...> - 2003-10-19 09:00:01
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10 In directory sc8-pr-cvs1:/tmp/cvs-serv21798 Modified Files: changelog.txt Log Message: Updated CHANGELOG.TXT Index: changelog.txt =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/changelog.txt,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** changelog.txt 18 Oct 2003 13:40:07 -0000 1.48 --- changelog.txt 18 Oct 2003 14:49:17 -0000 1.49 *************** *** 9,15 **** - Added specific classes for handle PostgreSQL Geometric types ! - Added handling of line, lseg and box geometric PostgreSQL types ! ! - Added handling of polygon geometric PostgreSQL types only for read at this moment --- 9,13 ---- - Added specific classes for handle PostgreSQL Geometric types ! - Added handling of line, lseg, box, polygon, path geometric PostgreSQL types |
|
From: <car...@us...> - 2003-10-19 08:22:05
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient
In directory sc8-pr-cvs1:/tmp/cvs-serv21474
Modified Files:
PgDbClient.cs PgOutputPacket.cs PgResponsePacket.cs
Log Message:
Added support for path geometric type and finish support for polygon type
Index: PgDbClient.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgDbClient.cs,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** PgDbClient.cs 18 Oct 2003 13:39:02 -0000 1.24
--- PgDbClient.cs 18 Oct 2003 14:46:26 -0000 1.25
***************
*** 667,671 ****
types.Add(602 , "path" , PgDataType.Path , Type.GetType("System.Array") , 0, 1, -1);
types.Add(603 , "box" , PgDataType.Box , Type.GetType("System.Array") , 600, 1, 32);
! types.Add(604 , "polygon" , PgDataType.Polygon , Type.GetType("System.Array") , 0, 1, -1);
types.Add(628 , "line" , PgDataType.Line , Type.GetType("System.Array") , 701, 1, 32);
types.Add(718 , "circle" , PgDataType.Circle , Type.GetType("System.Array") , 0, 1, 24);
--- 667,671 ----
types.Add(602 , "path" , PgDataType.Path , Type.GetType("System.Array") , 0, 1, -1);
types.Add(603 , "box" , PgDataType.Box , Type.GetType("System.Array") , 600, 1, 32);
! types.Add(604 , "polygon" , PgDataType.Polygon , Type.GetType("System.Array") , 0, 1, 16);
types.Add(628 , "line" , PgDataType.Line , Type.GetType("System.Array") , 701, 1, 32);
types.Add(718 , "circle" , PgDataType.Circle , Type.GetType("System.Array") , 0, 1, 24);
Index: PgOutputPacket.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgOutputPacket.cs,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** PgOutputPacket.cs 18 Oct 2003 12:56:56 -0000 1.12
--- PgOutputPacket.cs 18 Oct 2003 14:46:26 -0000 1.13
***************
*** 178,181 ****
--- 178,197 ----
}
+ public void WritePolygon(PgPolygon polygon)
+ {
+ for (int i = 0; i < polygon.Points.Length; i++)
+ {
+ WritePoint(polygon.Points[0]);
+ }
+ }
+
+ public void WritePath(PgPath path)
+ {
+ for (int i = 0; i < path.Points.Length; i++)
+ {
+ WritePoint(path.Points[0]);
+ }
+ }
+
// Parameters
***************
*** 355,360 ****
break;
- case PgDataType.Path:
case PgDataType.Polygon:
break;
}
--- 371,386 ----
break;
case PgDataType.Polygon:
+ PgPolygon polygon = value as PgPolygon;
+
+ packet.WriteInt(size*polygon.Points.Length);
+ packet.WritePolygon(polygon);
+ break;
+
+ case PgDataType.Path:
+ PgPath path = value as PgPath;
+
+ packet.WriteInt(size*path.Points.Length);
+ packet.WritePath(path);
break;
}
Index: PgResponsePacket.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgResponsePacket.cs,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** PgResponsePacket.cs 18 Oct 2003 13:39:02 -0000 1.12
--- PgResponsePacket.cs 18 Oct 2003 14:46:26 -0000 1.13
***************
*** 115,119 ****
#endregion
! #region METHODS
public string ReadNullString()
--- 115,119 ----
#endregion
! #region READ_METHODS
public string ReadNullString()
***************
*** 340,343 ****
--- 340,356 ----
}
+ public PgPath ReadPath()
+ {
+ bool isClosedPath = this.ReadBoolean();
+ PgPoint[] points = new PgPoint[this.ReadInt()];
+
+ for (int i = 0; i < points.Length; i++)
+ {
+ points[i] = this.ReadPoint();
+ }
+
+ return new PgPath(isClosedPath, points);
+ }
+
// Common read method
***************
*** 422,425 ****
--- 435,440 ----
case PgDataType.Path:
+ return this.ReadPath();
+
default:
return ReadBytes(length);
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgTypes In directory sc8-pr-cvs1:/tmp/cvs-serv31043 Added Files: PgBox.cs PgCircle.cs PgLine.cs PgLSeg.cs PgPath.cs PgPoint.cs PgPolygon.cs Log Message: Added specific classes for handle Postgres Geometric types --- NEW FILE: PgBox.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: PgCircle.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: PgLine.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: PgLSeg.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: PgPath.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: PgPoint.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: PgPolygon.cs --- (This appears to be a binary file; contents omitted.) |
|
From: <car...@us...> - 2003-10-19 05:39:51
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgTypes
In directory sc8-pr-cvs1:/tmp/cvs-serv7438
Modified Files:
PgBox.cs
Log Message:
Added implementation for PgBox type
Index: PgBox.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgTypes/PgBox.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PgBox.cs 18 Oct 2003 11:57:37 -0000 1.1
--- PgBox.cs 18 Oct 2003 12:59:53 -0000 1.2
***************
*** 23,29 ****
public class PgBox
{
! public PgBox()
{
}
}
}
--- 23,107 ----
public class PgBox
{
! #region FIELDS
!
! private PgPoint upperRight;
! private PgPoint lowerLeft;
!
! #endregion
!
! #region PROPERTIES
!
! public PgPoint UpperRight
! {
! get { return upperRight; }
! }
!
! public PgPoint LowerLeft
! {
! get { return lowerLeft; }
! }
!
! #endregion
!
! #region CONSTRUCTORS
!
! public PgBox(PgPoint upperRigth, PgPoint lowerLeft)
! {
! this.upperRight = upperRigth;
! this.lowerLeft = lowerLeft;
! }
!
! #endregion
!
! #region OPERATORS
!
! public static bool operator ==(PgBox left, PgBox right)
! {
! if (left.UpperRight == right.UpperRight &&
! left.LowerLeft == right.LowerLeft)
! {
! return true;
! }
! else
! {
! return false;
! }
! }
!
! public static bool operator !=(PgBox left, PgBox right)
! {
! if (left.UpperRight != right.UpperRight ||
! left.LowerLeft != right.LowerLeft)
! {
! return true;
! }
! else
! {
! return false;
! }
! }
!
! #endregion
!
! #region OVERRIDEN_METHODS
!
! public override int GetHashCode()
! {
! return base.GetHashCode();
! }
!
! public override bool Equals(object obj)
{
+ if (obj is PgBox)
+ {
+ return (obj as PgBox) == this;
+ }
+ else
+ {
+ return false;
+ }
}
+
+ #endregion
}
}
|
|
From: <car...@us...> - 2003-10-19 04:30:59
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgTypes In directory sc8-pr-cvs1:/tmp/cvs-serv30816/PgTypes Log Message: Directory /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgTypes added to the repository |
|
From: <car...@us...> - 2003-10-18 19:16:53
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10 In directory sc8-pr-cvs1:/tmp/cvs-serv29691 Modified Files: changelog.txt Log Message: Updated CHANGELOG.TXT Index: changelog.txt =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/changelog.txt,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** changelog.txt 18 Oct 2003 14:49:17 -0000 1.49 --- changelog.txt 18 Oct 2003 19:15:41 -0000 1.50 *************** *** 7,10 **** --- 7,14 ---- * Protocol implementation: + - Improved types handling + + - Added definitions of geometric array types + - Added specific classes for handle PostgreSQL Geometric types |
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient
In directory sc8-pr-cvs1:/tmp/cvs-serv29474
Modified Files:
PgDataType.cs PgDbClient.cs PgType.cs PgTypeCollection.cs
Log Message:
- Improved types handling
- Added definitions of geometric array types
Index: PgDataType.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgDataType.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PgDataType.cs 17 Oct 2003 18:24:02 -0000 1.1
--- PgDataType.cs 18 Oct 2003 19:14:43 -0000 1.2
***************
*** 30,34 ****
Boolean ,
Box ,
! Byte ,
Char ,
Circle ,
--- 30,34 ----
Boolean ,
Box ,
! Byte ,
Char ,
Circle ,
***************
*** 39,50 ****
Float ,
Int2 ,
! Int4 ,
Int8 ,
Line ,
LSeg ,
! Numeric ,
Path ,
Point ,
! Polygon ,
Text ,
Time ,
--- 39,50 ----
Float ,
Int2 ,
! Int4 ,
Int8 ,
Line ,
LSeg ,
! Numeric ,
Path ,
Point ,
! Polygon ,
Text ,
Time ,
Index: PgDbClient.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgDbClient.cs,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** PgDbClient.cs 18 Oct 2003 14:46:26 -0000 1.25
--- PgDbClient.cs 18 Oct 2003 19:14:43 -0000 1.26
***************
*** 650,696 ****
types = new PgTypeCollection();
! types.Add(16 , "bool" , PgDataType.Boolean , Type.GetType("System.Boolean") , 0, 1, 1);
! types.Add(17 , "bytea" , PgDataType.Binary , Type.GetType("System.Array") , 0, 1, 0);
! types.Add(18 , "char" , PgDataType.Char , Type.GetType("System.String") , 0, 0, 0);
! types.Add(19 , "name" , PgDataType.VarChar , Type.GetType("System.String") , 0, 0, 0);
! types.Add(20 , "int8" , PgDataType.Int8 , Type.GetType("System.Int64") , 0, 1, 8);
! types.Add(21 , "int2" , PgDataType.Int2 , Type.GetType("System.Int16") , 0, 1, 2);
! types.Add(22 , "int2vector", PgDataType.Vector , Type.GetType("System.Array") , 21, 1, 2);
! types.Add(23 , "int4" , PgDataType.Int4 , Type.GetType("System.Int32") , 0, 1, 4);
! types.Add(24 , "regproc" , PgDataType.VarChar , Type.GetType("System.String") , 0, 0, 0);
! types.Add(25 , "text" , PgDataType.VarChar , Type.GetType("System.String") , 0, 0, 0);
! types.Add(26 , "oid" , PgDataType.Int4 , Type.GetType("System.Int32") , 0, 1, 4);
! types.Add(30 , "oidvector", PgDataType.Vector , Type.GetType("System.Array") , 26, 1, 4);
!
! types.Add(600 , "point" , PgDataType.Point , Type.GetType("System.Array") , 701, 1, 16);
! types.Add(601 , "lseg" , PgDataType.LSeg , Type.GetType("System.Array") , 600, 1, 32);
! types.Add(602 , "path" , PgDataType.Path , Type.GetType("System.Array") , 0, 1, -1);
! types.Add(603 , "box" , PgDataType.Box , Type.GetType("System.Array") , 600, 1, 32);
! types.Add(604 , "polygon" , PgDataType.Polygon , Type.GetType("System.Array") , 0, 1, 16);
! types.Add(628 , "line" , PgDataType.Line , Type.GetType("System.Array") , 701, 1, 32);
! types.Add(718 , "circle" , PgDataType.Circle , Type.GetType("System.Array") , 0, 1, 24);
!
! types.Add(700 , "float4" , PgDataType.Float , Type.GetType("System.Single") , 0, 1, 4);
! types.Add(701 , "float8" , PgDataType.Double , Type.GetType("System.Double") , 0, 1, 8);
! // types.Add(705 , "unknown" , DbType.Object , Type.GetType("System.Object") , 0, 0, 0);
! types.Add(790 , "money" , PgDataType.Currency , Type.GetType("System.Decimal") , 0, 1, 4);
! types.Add(829 , "macaddr" , PgDataType.VarChar , Type.GetType("System.String") , 0, 0, 6);
! types.Add(869 , "inet" , PgDataType.VarChar , Type.GetType("System.String") , 0, 0, 0);
! types.Add(1005 , "_int2" , PgDataType.Binary , Type.GetType("System.Array") , 21, 1, 2);
! types.Add(1007 , "_int4" , PgDataType.Binary , Type.GetType("System.Array") , 23, 1, 4);
! types.Add(1016 , "_int8" , PgDataType.Binary , Type.GetType("System.Array") , 20, 1, 8);
! types.Add(1009 , "_text" , PgDataType.Binary , Type.GetType("System.Array") , 25, 1, 0);
! types.Add(1021 , "_float4" , PgDataType.Binary , Type.GetType("System.Array") , 700, 1, 4);
! types.Add(1033 , "aclitem" , PgDataType.VarChar , Type.GetType("System.String") , 0, 0, 12);
! types.Add(1034 , "_aclitem", PgDataType.Binary , Type.GetType("System.Array") , 1033, 0, 0);
! types.Add(1042 , "bpchar" , PgDataType.VarChar , Type.GetType("System.String") , 0, 0, 0);
! types.Add(1043 , "varchar" , PgDataType.VarChar , Type.GetType("System.String") , 0, 0, 0);
! types.Add(1082 , "date" , PgDataType.Date , Type.GetType("System.DateTime") , 0, 1, 4);
! types.Add(1083 , "time" , PgDataType.Time , Type.GetType("System.DateTime") , 0, 1, 8);
! types.Add(1114 , "timestamp", PgDataType.TimeStamp , Type.GetType("System.DateTime") , 0, 1, 8);
! types.Add(1560 , "bit" , PgDataType.Byte , Type.GetType("System.Byte") , 0, 0, 1);
! types.Add(1562 , "varbit" , PgDataType.Byte , Type.GetType("System.Byte") , 0, 1, 0);
! types.Add(1700 , "numeric" , PgDataType.Decimal , Type.GetType("System.Decimal") , 0, 0, 8);
! types.Add(2277 , "anyarray", PgDataType.Binary , Type.GetType("System.Array") , 0, 1, 8);
}
--- 650,701 ----
types = new PgTypeCollection();
! types.Add(16 , "bool" , PgDataType.Boolean , 0, 1, 1);
! types.Add(17 , "bytea" , PgDataType.Binary , 0, 1, 0);
! types.Add(18 , "char" , PgDataType.Char , 0, 0, 0);
! types.Add(19 , "name" , PgDataType.VarChar , 0, 0, 0);
! types.Add(20 , "int8" , PgDataType.Int8 , 0, 1, 8);
! types.Add(21 , "int2" , PgDataType.Int2 , 0, 1, 2);
! types.Add(22 , "int2vector" , PgDataType.Vector , 21, 1, 2);
! types.Add(23 , "int4" , PgDataType.Int4 , 0, 1, 4);
! types.Add(24 , "regproc" , PgDataType.VarChar , 0, 0, 0);
! types.Add(25 , "text" , PgDataType.VarChar , 0, 0, 0);
! types.Add(26 , "oid" , PgDataType.Int4 , 0, 1, 4);
! types.Add(30 , "oidvector" , PgDataType.Vector , 26, 1, 4);
! types.Add(600 , "point" , PgDataType.Point , 701, 1, 16);
! types.Add(601 , "lseg" , PgDataType.LSeg , 600, 1, 32);
! types.Add(602 , "path" , PgDataType.Path , 0, 1, -1);
! types.Add(603 , "box" , PgDataType.Box , 600, 1, 32);
! types.Add(604 , "polygon" , PgDataType.Polygon , 0, 1, 16);
! types.Add(628 , "line" , PgDataType.Line , 701, 1, 32);
! types.Add(629 , "_line" , PgDataType.Array , 628, 1, 32);
! types.Add(718 , "circle" , PgDataType.Circle , 0, 1, 24);
! types.Add(719 , "_circle" , PgDataType.Array , 718, 1, 24);
! types.Add(700 , "float4" , PgDataType.Float , 0, 1, 4);
! types.Add(701 , "float8" , PgDataType.Double , 0, 1, 8);
! types.Add(705 , "unknown" , PgDataType.Binary , 0, 1, 0);
! types.Add(790 , "money" , PgDataType.Currency , 0, 1, 4);
! types.Add(829 , "macaddr" , PgDataType.VarChar , 0, 0, 6);
! types.Add(869 , "inet" , PgDataType.VarChar , 0, 0, 0);
! types.Add(1005 , "_int2" , PgDataType.Array , 21, 1, 2);
! types.Add(1007 , "_int4" , PgDataType.Array , 23, 1, 4);
! types.Add(1009 , "_text" , PgDataType.Array , 25, 1, 0);
! types.Add(1016 , "_int8" , PgDataType.Array , 20, 1, 8);
! types.Add(1017 , "_point" , PgDataType.Array , 600, 1, 16);
! types.Add(1018 , "_lseg" , PgDataType.Array , 601, 1, 32);
! types.Add(1019 , "_path" , PgDataType.Array , 602, 1, -1);
! types.Add(1020 , "_box" , PgDataType.Array , 603, 1, 32);
! types.Add(1021 , "_float4" , PgDataType.Array , 700, 1, 4);
! types.Add(1027 , "_polygon" , PgDataType.Array , 604, 1, 16);
! types.Add(1033 , "aclitem" , PgDataType.VarChar , 0, 0, 12);
! types.Add(1034 , "_aclitem" , PgDataType.Array , 1033, 0, 0);
! types.Add(1042 , "bpchar" , PgDataType.VarChar , 0, 0, 0);
! types.Add(1043 , "varchar" , PgDataType.VarChar , 0, 0, 0);
! types.Add(1082 , "date" , PgDataType.Date , 0, 1, 4);
! types.Add(1083 , "time" , PgDataType.Time , 0, 1, 8);
! types.Add(1114 , "timestamp" , PgDataType.TimeStamp , 0, 1, 8);
! types.Add(1560 , "bit" , PgDataType.Byte , 0, 0, 1);
! types.Add(1562 , "varbit" , PgDataType.Byte , 0, 1, 0);
! types.Add(1700 , "numeric" , PgDataType.Decimal , 0, 0, 8);
! types.Add(2277 , "anyarray" , PgDataType.Array , 0, 1, 8);
}
Index: PgType.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgType.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** PgType.cs 17 Oct 2003 18:55:04 -0000 1.5
--- PgType.cs 18 Oct 2003 19:14:43 -0000 1.6
***************
*** 57,61 ****
get { return systemType; }
}
!
public int ElementType
{
--- 57,61 ----
get { return systemType; }
}
!
public int ElementType
{
***************
*** 87,99 ****
#region CONSTRUCTORS
! public PgType(int oid, string name, PgDataType dataType, Type systemType, int elementType, short formatCode, int size)
{
this.oid = oid;
this.name = name;
this.dataType = dataType;
- this.systemType = systemType;
this.elementType = elementType;
this.formatCode = formatCode;
this.size = size;
}
--- 87,99 ----
#region CONSTRUCTORS
! public PgType(int oid, string name, PgDataType dataType, int elementType, short formatCode, int size)
{
this.oid = oid;
this.name = name;
this.dataType = dataType;
this.elementType = elementType;
this.formatCode = formatCode;
this.size = size;
+ this.systemType = this.inferSystemType();
}
***************
*** 106,117 ****
bool returnValue = false;
! if (dataType == PgDataType.Currency ||
! dataType == PgDataType.Int2 ||
! dataType == PgDataType.Int4 ||
! dataType == PgDataType.Int8 ||
! dataType == PgDataType.Float ||
! dataType == PgDataType.Double ||
! dataType == PgDataType.Decimal ||
! dataType == PgDataType.Byte)
{
returnValue = true;
--- 106,117 ----
bool returnValue = false;
! if (this.dataType == PgDataType.Currency ||
! this.dataType == PgDataType.Int2 ||
! this.dataType == PgDataType.Int4 ||
! this.dataType == PgDataType.Int8 ||
! this.dataType == PgDataType.Float ||
! this.dataType == PgDataType.Double ||
! this.dataType == PgDataType.Decimal ||
! this.dataType == PgDataType.Byte)
{
returnValue = true;
***************
*** 125,129 ****
bool returnValue = false;
! if (dataType == PgDataType.Binary)
{
returnValue = true;
--- 125,129 ----
bool returnValue = false;
! if (this.dataType == PgDataType.Binary)
{
returnValue = true;
***************
*** 131,134 ****
--- 131,197 ----
return returnValue;
+ }
+
+ #endregion
+
+ #region PRIVATE_METHODS
+
+ private Type inferSystemType()
+ {
+ switch (this.dataType)
+ {
+ case PgDataType.Array:
+ case PgDataType.Binary:
+ case PgDataType.Vector:
+ return Type.GetType("System.Array");
+
+ case PgDataType.Boolean:
+ return Type.GetType("System.Boolean");
+
+ case PgDataType.Box:
+ case PgDataType.Circle:
+ case PgDataType.Line:
+ case PgDataType.LSeg:
+ case PgDataType.Path:
+ case PgDataType.Point:
+ case PgDataType.Polygon:
+ return Type.GetType("System.Object");
+
+ case PgDataType.Byte:
+ return Type.GetType("System.Byte");
+
+ case PgDataType.Char:
+ case PgDataType.Text:
+ case PgDataType.VarChar:
+ return Type.GetType("System.String");
+
+ case PgDataType.Currency:
+ case PgDataType.Decimal:
+ case PgDataType.Numeric:
+ return Type.GetType("System.Decimal");
+
+ case PgDataType.Date:
+ case PgDataType.Time:
+ case PgDataType.TimeStamp:
+ return Type.GetType("System.DateTime");
+
+ case PgDataType.Double:
+ return Type.GetType("System.Double");
+
+ case PgDataType.Float:
+ return Type.GetType("System.Float");
+
+ case PgDataType.Int2:
+ return Type.GetType("System.Int16");
+
+ case PgDataType.Int4:
+ return Type.GetType("System.Int32");
+
+ case PgDataType.Int8:
+ return Type.GetType("System.Int64");
+
+ default:
+ return Type.GetType("System.Object");
+ }
}
Index: PgTypeCollection.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgTypeCollection.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** PgTypeCollection.cs 17 Oct 2003 18:55:04 -0000 1.5
--- PgTypeCollection.cs 18 Oct 2003 19:14:43 -0000 1.6
***************
*** 95,101 ****
}
! public PgType Add(int oid, string name, PgDataType dataType, Type systemType, int elementType, short formatCode, int size)
{
! PgType type = new PgType(oid, name, dataType, systemType, elementType, formatCode, size);
base.Add(type);
--- 95,101 ----
}
! public PgType Add(int oid, string name, PgDataType dataType, int elementType, short formatCode, int size)
{
! PgType type = new PgType(oid, name, dataType, elementType, formatCode, size);
base.Add(type);
|
|
From: <car...@us...> - 2003-10-18 13:40:53
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient
In directory sc8-pr-cvs1:/tmp/cvs-serv12363
Modified Files:
PgDbClient.cs PgResponsePacket.cs
Log Message:
Added support for Polygon type ( read only at this moment )
Index: PgDbClient.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgDbClient.cs,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** PgDbClient.cs 17 Oct 2003 20:47:55 -0000 1.23
--- PgDbClient.cs 18 Oct 2003 13:39:02 -0000 1.24
***************
*** 665,671 ****
types.Add(600 , "point" , PgDataType.Point , Type.GetType("System.Array") , 701, 1, 16);
types.Add(601 , "lseg" , PgDataType.LSeg , Type.GetType("System.Array") , 600, 1, 32);
! types.Add(602 , "path" , PgDataType.VarChar , Type.GetType("System.String") , 0, 0, -1);
types.Add(603 , "box" , PgDataType.Box , Type.GetType("System.Array") , 600, 1, 32);
! types.Add(604 , "polygon" , PgDataType.VarChar , Type.GetType("System.String") , 0, 0, -1);
types.Add(628 , "line" , PgDataType.Line , Type.GetType("System.Array") , 701, 1, 32);
types.Add(718 , "circle" , PgDataType.Circle , Type.GetType("System.Array") , 0, 1, 24);
--- 665,671 ----
types.Add(600 , "point" , PgDataType.Point , Type.GetType("System.Array") , 701, 1, 16);
types.Add(601 , "lseg" , PgDataType.LSeg , Type.GetType("System.Array") , 600, 1, 32);
! types.Add(602 , "path" , PgDataType.Path , Type.GetType("System.Array") , 0, 1, -1);
types.Add(603 , "box" , PgDataType.Box , Type.GetType("System.Array") , 600, 1, 32);
! types.Add(604 , "polygon" , PgDataType.Polygon , Type.GetType("System.Array") , 0, 1, -1);
types.Add(628 , "line" , PgDataType.Line , Type.GetType("System.Array") , 701, 1, 32);
types.Add(718 , "circle" , PgDataType.Circle , Type.GetType("System.Array") , 0, 1, 24);
Index: PgResponsePacket.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgResponsePacket.cs,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** PgResponsePacket.cs 18 Oct 2003 12:56:56 -0000 1.11
--- PgResponsePacket.cs 18 Oct 2003 13:39:02 -0000 1.12
***************
*** 108,111 ****
--- 108,116 ----
}
+ public byte[] ToArray()
+ {
+ return ((MemoryStream)BaseStream).ToArray();
+ }
+
#endregion
***************
*** 323,326 ****
--- 328,343 ----
}
+ public PgPolygon ReadPolygon()
+ {
+ PgPoint[] points = new PgPoint[this.ReadInt()];
+
+ for (int i = 0; i < points.Length; i++)
+ {
+ points[i] = this.ReadPoint();
+ }
+
+ return new PgPolygon(points);
+ }
+
// Common read method
***************
*** 401,406 ****
return this.ReadBox();
- case PgDataType.Path:
case PgDataType.Polygon:
default:
return ReadBytes(length);
--- 418,425 ----
return this.ReadBox();
case PgDataType.Polygon:
+ return this.ReadPolygon();
+
+ case PgDataType.Path:
default:
return ReadBytes(length);
|
|
From: <car...@us...> - 2003-10-18 13:40:45
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgTypes
In directory sc8-pr-cvs1:/tmp/cvs-serv12271
Modified Files:
PgPolygon.cs
Log Message:
Added support for Polygon type ( read only at this moment )
Index: PgPolygon.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgTypes/PgPolygon.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PgPolygon.cs 18 Oct 2003 11:57:37 -0000 1.1
--- PgPolygon.cs 18 Oct 2003 13:38:40 -0000 1.2
***************
*** 23,29 ****
public class PgPolygon
{
! public PgPolygon()
{
}
}
}
--- 23,133 ----
public class PgPolygon
{
! #region FIELDS
!
! private PgPoint[] points;
!
! #endregion
!
! #region PROPERTIES
!
! public PgPoint[] Points
! {
! get { return points; }
! }
!
! #endregion
!
! #region CONSTRUCTORS
!
! public PgPolygon(PgPoint[] points)
! {
! this.points = (PgPoint[])points.Clone();
! }
!
! #endregion
!
! #region OPERATORS
!
! public static bool operator ==(PgPolygon left, PgPolygon right)
! {
! bool equals = false;
!
! if (left.Points.Length == right.Points.Length)
! {
! equals = true;
! for (int i = 0; i < left.Points.Length; i++)
! {
! if (left.Points[i] != right.Points[i])
! {
! equals = false;
! break;
! }
! }
! }
!
! return equals;
! }
!
! public static bool operator !=(PgPolygon left, PgPolygon right)
! {
! bool notequals = true;
!
! if (left.Points.Length == right.Points.Length)
! {
! notequals = false;
! for (int i = 0; i < left.Points.Length; i++)
! {
! if (left.Points[i] != right.Points[i])
! {
! notequals = true;
! break;
! }
! }
! }
!
! return notequals;
! }
!
! #endregion
!
! #region OVERRIDEN_METHODS
!
! public override string ToString()
{
+ System.Text.StringBuilder b = new System.Text.StringBuilder();
+
+ for (int i = 0; i < this.points.Length; i++)
+ {
+ if (b.Length > 0)
+ {
+ b.Append(",");
+ }
+ b.AppendFormat("({0},{1}),({2},{3})",
+ this.points[0].X, this.points[i].Y);
+ }
+
+ b.AppendFormat("( {0} )", b.ToString());
+
+ return b.ToString();
+ }
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (obj is PgPolygon)
+ {
+ return (obj as PgPolygon) == this;
+ }
+ else
+ {
+ return false;
+ }
}
+
+ #endregion
}
}
|
|
From: <car...@us...> - 2003-10-18 13:40:28
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10 In directory sc8-pr-cvs1:/tmp/cvs-serv12488 Modified Files: changelog.txt Log Message: Updated CHANGELOG.TXT Index: changelog.txt =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/changelog.txt,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** changelog.txt 18 Oct 2003 12:57:41 -0000 1.47 --- changelog.txt 18 Oct 2003 13:40:07 -0000 1.48 *************** *** 11,14 **** --- 11,16 ---- - Added handling of line, lseg and box geometric PostgreSQL types + - Added handling of polygon geometric PostgreSQL types only for read at this moment + 2003-10-17 Carlos Guzmán Álvarez <car...@te...> |
|
From: <car...@us...> - 2003-10-18 13:11:41
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgTypes
In directory sc8-pr-cvs1:/tmp/cvs-serv8924
Modified Files:
PgBox.cs PgCircle.cs PgLine.cs PgLSeg.cs PgPoint.cs
Log Message:
Added ToString implementation using PostgreSQL format
Index: PgBox.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgTypes/PgBox.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** PgBox.cs 18 Oct 2003 12:59:53 -0000 1.2
--- PgBox.cs 18 Oct 2003 13:11:18 -0000 1.3
***************
*** 46,52 ****
#region CONSTRUCTORS
! public PgBox(PgPoint upperRigth, PgPoint lowerLeft)
{
! this.upperRight = upperRigth;
this.lowerLeft = lowerLeft;
}
--- 46,52 ----
#region CONSTRUCTORS
! public PgBox(PgPoint upperRight, PgPoint lowerLeft)
{
! this.upperRight = upperRight;
this.lowerLeft = lowerLeft;
}
***************
*** 85,88 ****
--- 85,98 ----
#region OVERRIDEN_METHODS
+
+ public override string ToString()
+ {
+ System.Text.StringBuilder b = new System.Text.StringBuilder();
+ b.AppendFormat("(({0},{1}),({2},{3}))",
+ this.upperRight.X , this.upperRight.Y,
+ this.lowerLeft.X , this.lowerLeft.Y);
+
+ return b.ToString();
+ }
public override int GetHashCode()
Index: PgCircle.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgTypes/PgCircle.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PgCircle.cs 18 Oct 2003 11:57:37 -0000 1.1
--- PgCircle.cs 18 Oct 2003 13:11:18 -0000 1.2
***************
*** 84,87 ****
--- 84,96 ----
#region OVERRIDEN_METHODS
+ public override string ToString()
+ {
+ System.Text.StringBuilder b = new System.Text.StringBuilder();
+ b.AppendFormat("<({0},{1}),{2}>",
+ this.center.X, this.center.Y, this.radius);
+
+ return b.ToString();
+ }
+
public override int GetHashCode()
{
Index: PgLine.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgTypes/PgLine.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PgLine.cs 18 Oct 2003 11:57:37 -0000 1.1
--- PgLine.cs 18 Oct 2003 13:11:18 -0000 1.2
***************
*** 86,89 ****
--- 86,99 ----
#region OVERRIDEN_METHODS
+ public override string ToString()
+ {
+ System.Text.StringBuilder b = new System.Text.StringBuilder();
+ b.AppendFormat("(({0},{1}),({2},{3}))",
+ this.startPoint.X , this.startPoint.Y,
+ this.endPoint.X , this.endPoint.Y);
+
+ return b.ToString();
+ }
+
public override int GetHashCode()
{
Index: PgLSeg.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgTypes/PgLSeg.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PgLSeg.cs 18 Oct 2003 11:57:37 -0000 1.1
--- PgLSeg.cs 18 Oct 2003 13:11:18 -0000 1.2
***************
*** 86,89 ****
--- 86,99 ----
#region OVERRIDEN_METHODS
+ public override string ToString()
+ {
+ System.Text.StringBuilder b = new System.Text.StringBuilder();
+ b.AppendFormat("(({0},{1}),({2},{3}))",
+ this.startPoint.X , this.startPoint.Y,
+ this.endPoint.X , this.endPoint.Y);
+
+ return b.ToString();
+ }
+
public override int GetHashCode()
{
Index: PgPoint.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgTypes/PgPoint.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PgPoint.cs 18 Oct 2003 11:57:37 -0000 1.1
--- PgPoint.cs 18 Oct 2003 13:11:18 -0000 1.2
***************
*** 84,87 ****
--- 84,95 ----
#region OVERRIDEN_METHODS
+ public override string ToString()
+ {
+ System.Text.StringBuilder b = new System.Text.StringBuilder();
+ b.AppendFormat("({0},{1})", this.x, this.y);
+
+ return b.ToString();
+ }
+
public override int GetHashCode()
{
|
|
From: <car...@us...> - 2003-10-18 13:04:59
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10 In directory sc8-pr-cvs1:/tmp/cvs-serv7226 Modified Files: changelog.txt Log Message: Updated CHANGELOG.TXT Index: changelog.txt =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/changelog.txt,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** changelog.txt 18 Oct 2003 11:59:16 -0000 1.46 --- changelog.txt 18 Oct 2003 12:57:41 -0000 1.47 *************** *** 9,13 **** - Added specific classes for handle PostgreSQL Geometric types ! - Added handling of line and lseg postgres types --- 9,13 ---- - Added specific classes for handle PostgreSQL Geometric types ! - Added handling of line, lseg and box geometric PostgreSQL types |
|
From: <car...@us...> - 2003-10-18 13:04:22
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient
In directory sc8-pr-cvs1:/tmp/cvs-serv7111
Modified Files:
PgOutputPacket.cs PgResponsePacket.cs
Log Message:
Added support for Box Geometric type
Index: PgOutputPacket.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgOutputPacket.cs,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** PgOutputPacket.cs 18 Oct 2003 11:58:13 -0000 1.11
--- PgOutputPacket.cs 18 Oct 2003 12:56:56 -0000 1.12
***************
*** 172,175 ****
--- 172,181 ----
}
+ public void WriteBox(PgBox box)
+ {
+ WritePoint(box.UpperRight);
+ WritePoint(box.LowerLeft);
+ }
+
// Parameters
***************
*** 342,348 ****
break;
! case PgDataType.Box:
case PgDataType.Path:
-
case PgDataType.Polygon:
break;
--- 348,359 ----
break;
! case PgDataType.Box:
! PgBox box = value as PgBox;
!
! packet.WriteInt(size);
! packet.WriteBox(box);
! break;
!
case PgDataType.Path:
case PgDataType.Polygon:
break;
Index: PgResponsePacket.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgResponsePacket.cs,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** PgResponsePacket.cs 18 Oct 2003 11:58:13 -0000 1.10
--- PgResponsePacket.cs 18 Oct 2003 12:56:56 -0000 1.11
***************
*** 318,321 ****
--- 318,326 ----
}
+ public PgBox ReadBox()
+ {
+ return new PgBox(this.ReadPoint(), this.ReadPoint());
+ }
+
// Common read method
***************
*** 394,397 ****
--- 399,404 ----
case PgDataType.Box:
+ return this.ReadBox();
+
case PgDataType.Path:
case PgDataType.Polygon:
|