示例#1
0
		internal static RemoteCertificateValidationCallback GetClientValidationCallback (ConnectionParameters parameters)
		{
			var validator = parameters.ClientCertificateValidator;
			if (validator == null)
				return null;

			return ((CertificateValidator)validator).ValidationCallback;
		}
示例#2
0
		internal static X509Certificate2Collection GetClientCertificates (ConnectionParameters parameters)
		{
			if (parameters.ClientCertificate == null)
				return null;

			var clientCertificateCollection = new X509Certificate2Collection ();
			var certificate = (X509Certificate2)CertificateProvider.GetCertificate (parameters.ClientCertificate);
			clientCertificateCollection.Add (certificate);

			return clientCertificateCollection;
		}
        public void Should_construct_store_based_on_connection_params()
        {
            var connectionParams = new ConnectionParameters
            {
                Url = "http://localhost:8083",
                DatabaseName = "TestConnectionParams"
            };

            var settings = DefaultSettings();
            settings.Set(RavenDbSettingsExtensions.DefaultConnectionParameters, connectionParams);

            var storeInitializer = DocumentStoreManager.GetUninitializedDocumentStore<StorageType.Sagas>(settings);

            Assert.AreEqual("http://localhost:8083", storeInitializer.Url);
            Assert.AreEqual("http://localhost:8083 (DB: TestConnectionParams)", storeInitializer.Identifier);
        }
示例#4
0
        public void DoAssetRollup()
        {
            // Loop through each asset and fill the ASSET_SECTION_<network_id> table according to the rollup logic.
            AssetRollupMessaging.AddMessge("Begin asset rollup in network: " + m_networkID + " at " + DateTime.Now.ToString("HH:mm:ss"));
            String       query = "";
            StreamWriter tw    = null;

            if (DBOp.IsTableInDatabase("ASSET_SECTION_" + m_networkID))
            {
                // Drop the table as we are going to make a new one.
                try
                {
                    DBMgr.ExecuteNonQuery("DROP TABLE ASSET_SECTION_" + m_networkID);
                }
                catch (Exception exc)
                {
                    throw exc;
                }
            }

            // Creating the ASSET_SECTION_<networkID> table.
            AssetRollupMessaging.AddMessge("Creating ASSET_SECTION table...");
            List <DatabaseManager.TableParameters> listColumn = new List <DatabaseManager.TableParameters>();

            listColumn.Add(new DatabaseManager.TableParameters("GEO_ID", DataType.Int, false, false));
            listColumn.Add(new DatabaseManager.TableParameters("SECTIONID", DataType.Int, false, false));
            listColumn.Add(new DatabaseManager.TableParameters("ASSET_TYPE", DataType.VarChar(-1), false));
            listColumn.Add(new DatabaseManager.TableParameters("FACILITY", DataType.VarChar(-1), false));
            listColumn.Add(new DatabaseManager.TableParameters("BEGIN_STATION", DataType.Float, true));
            listColumn.Add(new DatabaseManager.TableParameters("END_STATION", DataType.Float, true));
            listColumn.Add(new DatabaseManager.TableParameters("DIRECTION", DataType.VarChar(50), true));
            listColumn.Add(new DatabaseManager.TableParameters("SECTION", DataType.VarChar(-1), true));
            listColumn.Add(new DatabaseManager.TableParameters("AREA", DataType.Float, true));
            listColumn.Add(new DatabaseManager.TableParameters("UNITS", DataType.VarChar(50), true));

            String strTable = "ASSET_SECTION_" + m_networkID;

            try
            {
                DBMgr.CreateTable(strTable, listColumn);
            }
            catch (Exception exc)
            {
                throw exc;
            }

            // Get a text writer and file ready to do a bulk copy.
            String strMyDocumentsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            strMyDocumentsFolder += "\\RoadCare Projects\\Temp";
            Directory.CreateDirectory(strMyDocumentsFolder);

            // LRS, Get the LRS data from each asset table...
            foreach (String assetName in m_assetNames)
            {
                AssetRollupMessaging.AddMessge("Rolling up LRS based asset " + assetName + "...");
                ConnectionParameters cp = DBMgr.GetAssetConnectionObject(assetName);
                List <String>        assetColumnNames = DBMgr.GetTableColumns(assetName, cp);
                if (assetColumnNames.Contains("BEGIN_STATION"))
                {
                    switch (cp.Provider)
                    {
                    case "MSSQL":
                        query = "SELECT GEO_ID, FACILITY, DIRECTION, BEGIN_STATION, END_STATION FROM " + assetName + " WHERE (FACILITY <> '' AND FACILITY IS NOT NULL) ORDER BY FACILITY, DIRECTION, BEGIN_STATION";
                        break;

                    case "ORACLE":
                        query = "SELECT GEO_ID, FACILITY, DIRECTION, BEGIN_STATION, END_STATION FROM " + assetName + " WHERE (FACILITY LIKE '_%' AND FACILITY IS NOT NULL) ORDER BY FACILITY, DIRECTION, BEGIN_STATION";
                        break;

                    default:
                        throw new NotImplementedException("TODO: Create ANSI implementation for XXXXXXXXXXXX");
                        //break;
                    }
                    String strOutFile = strMyDocumentsFolder + "\\" + assetName + ".txt";
                    tw = new StreamWriter(strOutFile);
                    DataSet    sectionSet;
                    DataReader assetReader;
                    try
                    {
                        // Get the Segmented network data from the SECTION_<networkID> table.
                        // sectionSet will hold the section data, and assetReader will loop through each asset.
                        sectionSet  = DBMgr.ExecuteQuery("SELECT SECTIONID, FACILITY, BEGIN_STATION, END_STATION, DIRECTION FROM SECTION_" + m_networkID + " WHERE BEGIN_STATION IS NOT NULL ORDER BY FACILITY, DIRECTION, BEGIN_STATION");
                        assetReader = new DataReader(query, cp);
                    }
                    catch (Exception exc)
                    {
                        throw exc;
                    }

                    // If there is data to read, start reading it.
                    if (assetReader.Read())
                    {
                        DataPoint assetInfo;
                        DataRow   sectionRow;
                        DataPoint sectionInfo;

                        bool bMoreData = true;

                        int iCurrentSection = 0;

                        // bMoreData is true while there is more data to read, and false when the dataReader is finished.
                        // we then go back to the foreach loop (outside the while) and start rolling up the next asset.
                        while (bMoreData)
                        {
                            // AssetInfo is going to hold this particular row of asset data.
                            assetInfo = new DataPoint(-1, (int)assetReader["GEO_ID"], assetReader["FACILITY"].ToString(), assetReader["BEGIN_STATION"].ToString(), assetReader["END_STATION"].ToString(), assetReader["DIRECTION"].ToString());

                            // SectionInfo is going to hold this particular row of sections data.
                            sectionRow  = sectionSet.Tables[0].Rows[iCurrentSection];
                            sectionInfo = new DataPoint((int)sectionRow["SECTIONID"], sectionRow["FACILITY"].ToString(), sectionRow["BEGIN_STATION"].ToString(), sectionRow["END_STATION"].ToString(), sectionRow["DIRECTION"].ToString());

                            // We increment the section if
                            // We increment the asset if
                            // AssetInSection returns:
                            // -1 increments asset
                            // 0 adds asset to Asset Rollup Table
                            // 1 increments section
                            bool bIncrementSection      = false;
                            bool bIncrementAsset        = false;
                            int  assetSectionComparison = AssetInSection(assetInfo, sectionInfo);

                            // Based on the result from AssetInSection we are going to increment something.  Here its the asset
                            if (assetSectionComparison < 0)
                            {
                                bIncrementAsset = true;
                            }
                            // Here, we have a match and we need to look ahead to see how many sections a linear asset might belong to
                            // before moving on to the next asset.  In either case, point or linear, we add the asset to the Rollup table.
                            else if (assetSectionComparison == 0)
                            {
                                AddAssetToRollupTable(assetInfo, sectionInfo, assetName, tw);
                                if (assetInfo.m_ptsExtent.Y != -1)                                      //don't bother with looking ahead if we're using point assets
                                {
                                    // Keep looping through the sections and checking to see if this asset is still valid for each
                                    // consecutive section.  When it fails on a section, we are done with the linear asset, otherwise
                                    // we add the asset to the new section. (This is why we needed the sections in a DataSet, as a
                                    // dataReader would not allow this type of operation...easily).
                                    for (int iSectionLookAhead = 1; iSectionLookAhead + iCurrentSection < sectionSet.Tables[0].Rows.Count; iSectionLookAhead++)
                                    {
                                        sectionRow  = sectionSet.Tables[0].Rows[iCurrentSection + iSectionLookAhead];
                                        sectionInfo = new DataPoint((int)sectionRow["SECTIONID"], sectionRow["FACILITY"].ToString(), sectionRow["BEGIN_STATION"].ToString(), sectionRow["END_STATION"].ToString(), sectionRow["DIRECTION"].ToString());
                                        if (AssetInSection(assetInfo, sectionInfo) == 0)
                                        {
                                            AddAssetToRollupTable(assetInfo, sectionInfo, assetName, tw);
                                        }
                                        else
                                        {
                                            break;
                                        }
                                    }
                                }
                                // Point asset match...we assigned the section already so just tell the loop to move to the next asset.
                                bIncrementAsset = true;
                            }
                            // AssetInSection returned non-zero, and was not negative.  Which is a long way of saying, it returned positive.
                            // so we need to increment the section on a positive result.
                            else
                            {
                                bIncrementSection = true;
                            }
                            if (bIncrementAsset)
                            {
                                if (bIncrementSection)
                                {
                                    // This can't happen logically, but was useful during debugging.
                                    throw new Exception();
                                }
                                else
                                {
                                    // Read in the new data if we are incrementing the asset
                                    bMoreData = assetReader.Read();
                                }
                            }
                            else
                            {
                                // Increment the section row in the section data set. (Assuming there are sections remaining)
                                // If there arent any sections remaining, then we can't assign any more assets can we?
                                // so that means we are done.
                                if (bIncrementSection)
                                {
                                    if (iCurrentSection + 1 < sectionSet.Tables[0].Rows.Count)
                                    {
                                        iCurrentSection++;
                                        bMoreData = true;
                                    }
                                    else
                                    {
                                        bMoreData = false;
                                    }
                                }
                                else
                                {
                                    // Again, impossible, but useful for debugging.
                                    throw new Exception();
                                }
                            }
                        }
                    }
                    tw.Close();
                    assetReader.Close();


                    AssetRollupMessaging.AddMessge("Bulk loading rolled up LRS asset data...");
                    // Now try to load all that beautifully segmented data into an Asset Rollup table. (tab delimited).
                    try
                    {
                        switch (DBMgr.NativeConnectionParameters.Provider)
                        {
                        case "MSSQL":
                            DBMgr.SQLBulkLoad("ASSET_SECTION_" + m_networkID, strOutFile, '\t');
                            break;

                        case "ORACLE":
                            throw new NotImplementedException("TODO: Figure out tables for DoAssetRollup()");

                        //DBMgr.OracleBulkLoad( DBMgr.NativeConnectionParameters, "ASSET_SECTION_" + m_networkID, strOutFile,
                        //break;
                        default:
                            throw new NotImplementedException("TODO: Create ANSI implementation for XXXXXXXXXXXX");
                            //break;
                        }
                    }
                    catch (Exception exc)
                    {
                        throw exc;
                    }
                }
            }

            AssetRollupMessaging.AddMessge("Finished LRS asset data rollup...");

            //foreach (String assetName in m_assetNames)
            //{
            //    AssetRollupMessaging.AddMessge("Rolling up SRS asset " + assetName + "...");
            //    ConnectionParameters cp = DBMgr.GetAssetConnectionObject(assetName);
            //    List<String> assetColumnNames = DBMgr.GetTableColumns(assetName, cp);
            //    if (assetColumnNames.Contains("SECTION"))
            //    {
            //        query = "SELECT GEO_ID, FACILITY, SECTION FROM " + assetName + " WHERE (SECTION <> '' AND SECTION IS NOT NULL) ORDER BY FACILITY, SECTION";
            //        String strOutFile = strMyDocumentsFolder + "\\" + assetName + ".txt";
            //        tw = new StreamWriter(strOutFile);
            //        DataReader sectionReader = null;
            //        DataReader assetReader = null;
            //        try
            //        {
            //            // Get the Segmented network data from the SECTION_<networkID> table.
            //            // sectionSet will hold the section data, and assetReader will loop through each asset.
            //            //sectionSet = DBMgr.ExecuteQuery("SELECT SECTIONID, FACILITY, SECTION SECTION_" + m_networkID + " WHERE SECTION IS NOT NULL ORDER BY FACILITY, SECTION");
            //            sectionReader = new DataReader("SELECT SECTIONID, FACILITY, SECTION FROM SECTION_" + m_networkID + " WHERE SECTION IS NOT NULL ORDER BY FACILITY, SECTION");
            //            assetReader = new DataReader(query, cp);
            //        }
            //        catch (Exception exc)
            //        {
            //            throw exc;
            //        }

            //        bool bContinue = true;
            //        String strFacility = "";
            //        String strSection = "";
            //        String strSectionID = "";
            //        String strAssetFacility = "";
            //        String strAssetSection = "";
            //        String strGeoID = "";



            //        while (bContinue)
            //        {
            //            if (strFacility == "")
            //            {
            //                if (!sectionReader.Read())
            //                {
            //                    bContinue = false;
            //                    continue;
            //                }
            //                strFacility = sectionReader["FACILITY"].ToString();
            //                strSection = sectionReader["SECTION"].ToString();
            //                strSectionID = sectionReader["SECTIONID"].ToString();
            //                //if (strSectionID == "1006136")
            //                //{ }
            //                //strFacility = strFacility.Replace(" ", "");
            //                //strSection = strSection.Replace(" ", "");

            //            }

            //            if (strAssetFacility == "")
            //            {
            //                if (!assetReader.Read())
            //                {
            //                    bContinue = false;
            //                    continue;
            //                }
            //                strAssetFacility = assetReader["FACILITY"].ToString();
            //                strAssetSection = assetReader["SECTION"].ToString();
            //                strGeoID = assetReader["GEO_ID"].ToString();
            //                //if (strAssetFacility == "NW - Connecticut Ave")
            //                //{ }

            //                //strAssetFacility = strAssetFacility.Replace(" ", "");
            //                //strAssetSection = strAssetSection.Replace(" ", "");
            //            }
            //            if (CompareInfo.GetCompareInfo("en-US").Compare(strFacility, strAssetFacility) < 0)
            //            {
            //                strFacility = "";
            //            }
            //            else if (CompareInfo.GetCompareInfo("en-US").Compare(strFacility, strAssetFacility) == 0)
            //            {
            //                if (CompareInfo.GetCompareInfo("en-US").Compare(strSection, strAssetSection) < 0)
            //                {
            //                    strFacility = "";
            //                }
            //                else if (CompareInfo.GetCompareInfo("en-US").Compare(strSection, strAssetSection) == 0)
            //                {
            //                    //Write out to file
            //                    tw.WriteLine(strGeoID
            //                    + "\t" + strSectionID
            //                    + "\t" + assetName
            //                    + "\t" + sectionReader["FACILITY"].ToString()
            //                    + "\t" //+ a.m_ptsExtent.X.ToString()
            //                    + "\t" //+ ((a.m_ptsExtent.Y == -1) ? "" : a.m_ptsExtent.Y.ToString())
            //                    + "\t" //+ a.m_strDirection
            //                    + "\t" + sectionReader["SECTION"].ToString()
            //                    + "\t" //+ a.m_strArea
            //                    + "\t"); //+ a.m_strUnit);
            //                    strAssetFacility = "";
            //                }
            //                else
            //                {
            //                    strAssetFacility = "";
            //                }
            //            }
            //            else
            //            {
            //                strAssetFacility = "";
            //            }

            //        }
            //        tw.Close();
            //        assetReader.Close();
            //        sectionReader.Close();

            //        AssetRollupMessaging.AddMessge("Bulk loading rolled up SRS asset data...");
            //        // Now try to load all that beautifully segmented data into an Asset Rollup table. (tab delimited).
            //        try
            //        {
            //            switch (cp.Provider)
            //            {
            //                case "MSSQL":
            //                    //query = "SELECT GEO_ID, FACILITY, SECTION FROM " + assetName + " WHERE (SECTION <> '' AND SECTION IS NOT NULL) ORDER BY FACILITY, SECTION";
            //                    DBMgr.SQLBulkLoad("ASSET_SECTION_" + m_networkID, strOutFile, '\t');
            //                    break;
            //                case "ORACLE":
            //                    query = "SELECT GEO_ID, FACILITY, SECTION FROM " + assetName + " WHERE (SECTION LIKE '_%' AND SECTION IS NOT NULL) ORDER BY FACILITY, SECTION";
            //                    break;
            //                default:
            //                    throw new NotImplementedException("TODO: Create ANSI implementation for XXXXXXXXXXXX");
            //                    break;
            //            }
            //        }
            //        catch (Exception exc)
            //        {
            //            throw exc;
            //        }
            //    }
            //}
            AssetRollupMessaging.AddMessge("Asset Rollup complete.");
        }
 public Task <MonoSslStream> CreateClientStreamAsync(Stream stream, string targetHost, ConnectionParameters parameters, CancellationToken cancellationToken)
 {
     return(CreateClientStreamAsync(stream, targetHost, parameters, new MSI.MonoTlsSettings(), cancellationToken));
 }
示例#6
0
 public DoImport(String strSQL, bool bIsLinear, bool bIsString, List <String> listFacility, String strAttributeName, ConnectionParameters cp)
 {
     m_strSQL            = strSQL;
     m_bIsLinear         = bIsLinear;
     m_bIsString         = bIsString;
     m_listRouteFacility = listFacility;
     m_strAttributeName  = strAttributeName;
     m_cp = cp;
 }
		public override IClient CreateClient (ConnectionParameters parameters)
		{
			return new OpenSslClient (this, parameters);
		}
示例#8
0
 public void Remove(ConnectionParameter parameterToRemove)
 {
     ConnectionParameters.Remove(parameterToRemove);
 }
		public async Task<MonoSslStream> CreateServerStreamAsync (Stream stream, ConnectionParameters parameters, MSI.MonoTlsSettings settings, CancellationToken cancellationToken)
		{
			var certificate = CertificateProvider.GetCertificate (parameters.ServerCertificate);
			var protocol = GetProtocol (parameters, true);

			CallbackHelpers.AddCertificateValidator (settings, parameters.ServerCertificateValidator);

			var askForCert = parameters.AskForClientCertificate || parameters.RequireClientCertificate;
			var sslStream = tlsProvider.CreateSslStream (stream, false, settings);
			var monoSslStream = new MonoSslStream (sslStream);

			try {
				await sslStream.AuthenticateAsServerAsync (certificate, askForCert, protocol, false).ConfigureAwait (false);
			} catch (Exception ex) {
				var lastError = monoSslStream.LastError;
				if (lastError != null)
					throw new AggregateException (ex, lastError);
				throw;
			}

			return monoSslStream;
		}
		public override IClient CreateClient (ConnectionParameters parameters)
		{
			if (SupportsMonoExtensions)
				return new MonoClient (this, parameters);
			else
				return new DotNetClient (this, parameters, this);
		}
示例#11
0
        public GenericGenerator(ConnectionParameters config)
        {
            mConfiguration = config;

            LoadAssembliesMappings();
        }
示例#12
0
 private ImapConnection(ConnectionParameters connectionParameters)
 {
     this.connectionParameters = connectionParameters;
 }
示例#13
0
        /// <summary>
        /// Forward Open Request
        /// </summary>
        /// <param name="si">Session Info</param>
        /// <param name="Path">Path to the target</param>
        /// <param name="O2T_Params">O2T_Params, leave as zero to automatically select</param>
        /// <returns>True if the ForwardOpen request was successful, false otherwise</returns>
        public static bool ForwardOpen(SessionInfo si, byte[] Path, short O2T_Params = 0)
#endif
        {
            ForwardOpenRequest fwdRequest = new ForwardOpenRequest(si.ConnectionParameters);

            fwdRequest.ConnectionTimeoutMultiplier = 0;

            if (O2T_Params == 0)
            {
                fwdRequest.O2T_ConnectionParameters = unchecked ((short)(NetworkConnectionParams.Owned |        //NA
                                                                         NetworkConnectionParams.Point2Point |  //Point2Point
                                                                         NetworkConnectionParams.HighPriority | //LowPriority
                                                                         NetworkConnectionParams.Variable |     //Variable
                                                                         508));                                 //508 uS
                fwdRequest.T2O_ConnectionParameters = fwdRequest.O2T_ConnectionParameters;
            }
            else
            {
                fwdRequest.O2T_ConnectionParameters = O2T_Params;
                fwdRequest.T2O_ConnectionParameters = O2T_Params;
            }

            //fwdRequest.O2T_RPI = 10000000;
            fwdRequest.O2T_RPI          = 2000;
            fwdRequest.T2O_RPI          = fwdRequest.O2T_RPI;
            fwdRequest.TransportTrigger = NetworkConnectionParams.CM_Transp_IsServer |      //CM_Transp_IsServer
                                          3 |
                                          NetworkConnectionParams.CM_Trig_App;
            fwdRequest.TransportTrigger = 0xA3;
            fwdRequest.Connection_Path  = Path;

            EncapsReply response = MessageRouter.SendMR_Request(si, (byte)ConnectionManagerService.ForwardOpen, CommonPaths.ConnectionManager,
                                                                fwdRequest.Pack());

            if (response == null)
            {
                return(false);
            }

            //Need to check the last codes...
            si.LastSessionError = (int)response.Status;

            //We actually need to find out if this is a success or failure...
            ForwardOpenReply fReply = response;

            if (fReply is ForwardOpenReply_Fail)
            {
                return(false);
            }

            //Need to copy some data into the connection parameters...
            ForwardOpenReply_Success fSucc = (ForwardOpenReply_Success)fReply;

            ConnectionParameters cParams = si.ConnectionParameters;

            cParams.O2T_CID         = fSucc.O2T_ConnectionId;
            cParams.T2O_CID         = fSucc.T2O_ConnectionId;
            cParams.O2T_API         = fSucc.O2T_API;
            cParams.T2O_API         = fSucc.T2O_API;
            si.ConnectionParameters = cParams;


            if (response.Status == 0)
            {
                return(true);
            }

            return(false);
        }
示例#14
0
        private void FormAttributeDocument_Load(object sender, EventArgs e)
        {
            SecureForm();


            // If the attribute is on a data server, then we need to check if the view created was a LRS or SRS based.
            // It is possible to have both, in which case we need not change the current (LRS) radio button.
            m_cp = DBMgr.GetAttributeConnectionObject(m_strAttribute);

            m_strLinearYearFilter   = "";
            m_strLinearRouteFilter  = "";
            m_strSectionYearFilter  = "";
            m_strSectionRouteFilter = "";

            this.TabText = m_strAttribute;
            this.Text    = m_strAttribute;


            if (m_cp == null)
            {
                Global.WriteOutput("Error:Could not connect to datasource.");
                return;
            }
            if (!m_cp.IsNative)
            {
                checkAllowEdit.CheckState = CheckState.Unchecked;
                checkAllowEdit.Enabled    = false;

                dgvAttribute.ReadOnly = true;
            }
            List <String> attributeColumnHeaders = DBMgr.GetTableColumns(m_strAttribute, m_cp);

            if (m_cp.IsNative == false)
            {
                if (attributeColumnHeaders.Contains("SECTION"))
                {
                    if (!attributeColumnHeaders.Contains("ROUTES"))
                    {
                        // Disable LRS
                        rbLinearRef.Checked  = false;
                        rbSectionRef.Checked = true;
                    }
                }
            }
            try
            {
                int iNumRecords;
                iNumRecords = DBMgr.GetTableCount(m_strAttribute, m_cp);

                LoadAttributeFilters();

                // Check to see if the number of records in the database is greater than 10k.
                // If it is, we dont want to display that many records on the screen unless we have to,
                // so we will default to the first ROUTE in the combo box as a filter.
                if (iNumRecords > 10000)
                {
                    // Make sure there is more than just the "All" item in the combo box.
                    // If there isnt, then there isnt much we can do about filtering the data anyway so...
                    if (cbRoutes.Items.Count > 1)
                    {
                        cbRoutes.Text = cbRoutes.Items[1].ToString();
                    }
                }
            }
            catch (Exception exc)
            {
                Global.WriteOutput("Error: Couldn't get record count for attribute " + m_strAttribute + ". " + exc.Message);
            }
            CreateDataGridView();

            // Check for a native attribute in m_cp, then execute the proper execute query.
            String  strSelect = "SELECT TYPE_ FROM ATTRIBUTES_ WHERE ATTRIBUTE_='" + m_strAttribute + "'";
            DataSet ds        = null;

            ds = DBMgr.ExecuteQuery(strSelect);

            if (ds.Tables[0].Rows[0].ItemArray[0].ToString() != "STRING")
            {
                m_bString = false;
            }

            // Set default LRS/SRS radio button
            // TODO: Should be remembered from previous attributes.  Perhaps, placing a "global" variable in the DBManager
            // is a fantastic solution to this problem.  OR we could create a static class called GLOBAL that would hold
            // global variables for us.  <---This is the answer.
            tsbDeleteAll.ToolTipText = "Query based delete.";
        }
示例#15
0
 // Token: 0x0600006A RID: 106 RVA: 0x00004EF8 File Offset: 0x000030F8
 public static IPop3Connection CreateInstance(ConnectionParameters connectionParameters)
 {
     return(Pop3Connection.hookableFactory.Value(connectionParameters).Initialize());
 }
示例#16
0
 // Token: 0x06000075 RID: 117 RVA: 0x0000509B File Offset: 0x0000329B
 private static IPop3Connection Factory(ConnectionParameters connectionParameters)
 {
     return(new Pop3Connection(connectionParameters).Initialize());
 }
示例#17
0
 // Token: 0x06000067 RID: 103 RVA: 0x00004ECD File Offset: 0x000030CD
 private Pop3Connection(ConnectionParameters connectionParameters)
 {
     this.connectionParameters = connectionParameters;
 }
		ISslStream ISslStreamProvider.CreateServerStream (Stream stream, ConnectionParameters parameters)
		{
			return CreateServerStream (stream, parameters);
		}
示例#19
0
 public static ImapConnection CreateInstance(ConnectionParameters connectionParameters)
 {
     return(new ImapConnection(connectionParameters).Initialize());
 }
		async Task<ISslStream> ISslStreamProvider.CreateServerStreamAsync (Stream stream, ConnectionParameters parameters, CancellationToken cancellationToken)
		{
			return await CreateServerStreamAsync (stream, parameters, cancellationToken).ConfigureAwait (false);
		}
示例#21
0
            internal GenevaAction(int icm, string extensionName, string operationName, Dictionary <string, string> actionParam)
            {
                try
                {
                    this.extensionName = extensionName;
                    this.operationName = operationName;
                    this.actionParam   = actionParam;
                    Uri dstsUri = null;
                    switch (SALsA.GetInstance(icm)?.ICM.CurrentICM.SiloId)
                    {
                    case 1:
                        this.actionsEnvironments = ActionsEnvironments.Public;
                        //dstsUri = new Uri("https://ch1-dsts.dsts.core.windows.net");
                        break;

                    case 5:
                        this.actionsEnvironments = ActionsEnvironments.Fairfax;
                        //dstsUri = new Uri("https://usgoveast-dsts.dsts.core.usgovcloudapi.net");
                        break;

                    case 3:
                        this.actionsEnvironments = ActionsEnvironments.Mooncake;
                        //dstsUri = new Uri("https://chinanorth-dsts.dsts.core.chinacloudapi.cn");
                        break;

                    case 8:
                        this.actionsEnvironments = ActionsEnvironments.Blackforest;
                        //dstsUri = new Uri("https://germanycentral-dsts.dsts.core.cloudapi.de");
                        break;

                    case -1:
                        this.actionsEnvironments = ActionsEnvironments.USNat;
                        dstsUri = new Uri("https://usnatw-dsts.dsts.core.eaglex.ic.gov");
                        break;

                    case -2:
                        this.actionsEnvironments = ActionsEnvironments.USSec;
                        dstsUri = new Uri("https://ussecw-dsts.dsts.core.microsoft.scloud");
                        break;

                    default:
                        Log.Warning("Unkown Environment. SilotId : {0}. Will default to public Environment! ", SALsA.GetInstance(icm)?.ICM.CurrentICM.SiloId);
                        goto case 1;
                    }

                    Log.Verbose("Creating GenevaAction for {0}: {1}, with parameters : {2}", extensionName, operationName,
                                Utility.ObjectToJson(actionParam));

                    //sts = new ClientHomeSts(dstsUri);
                    cp     = ConnectionParameters.Create(actionsEnvironments, Authentication.Instance.Cert, null, X509CertCredentialType.SubjectNameCredential);
                    client = new GenevaActionsRestAPIClient(cp);
                    Log.Verbose("Client created for {0}: {1}", extensionName, operationName);

                    var operationDetails = client.Extension.GetOperationDetails(extensionName, operationName);
                    Log.Verbose("operationDetails id : ", operationDetails.Id);

                    operationRequest = new OperationRequest
                    {
                        // TODO : a smarter way than takign first endpoint by default
                        Endpoint   = operationDetails.AllowedEndpoints[0],
                        Extension  = extensionName,
                        Id         = operationDetails.Id,
                        Parameters = actionParam
                    };
                    Log.Verbose("operationRequest populated. Extension : {0}", operationRequest.Extension);
                }
                catch (Exception ex)
                {
                    Log.Error("Failed GenevaAction {0}: {1}", extensionName, operationName);
                    Log.Exception(ex);
                }
            }
		public Task<MonoSslStream> CreateClientStreamAsync (Stream stream, string targetHost, ConnectionParameters parameters, CancellationToken cancellationToken)
		{
			return CreateClientStreamAsync (stream, targetHost, parameters, new MSI.MonoTlsSettings (), cancellationToken);
		}
示例#23
0
 public RawFramesSource(ConnectionParameters connectionParameters)
 {
     _connectionParameters =
         connectionParameters ?? throw new ArgumentNullException(nameof(connectionParameters));
 }
示例#24
0
		static IPortableEndPoint GetEndPoint (ConnectionParameters parameters)
		{
			if (parameters.EndPoint != null)
				return parameters.EndPoint;

			var support = DependencyInjector.Get<IPortableEndPointSupport> ();
			return support.GetLoopbackEndpoint (4433);
		}
示例#25
0
 private bool IsConnectionParametersEmpty()
 {
     return(ConnectionParameters.All(p => (string.IsNullOrEmpty(p.Name)) || (p.ComponentType != DatabaseModel.ConnectionStringComponentType.Text) ||
                                     (string.IsNullOrEmpty(p.TextValue)) || (p.TextValue == p.DefaultTextValue)));
 }
示例#26
0
		public MonoClient (MonoConnectionProvider provider, ConnectionParameters parameters)
			: base (provider, parameters)
		{
		}
示例#27
0
		public MonoServer (MonoConnectionProvider provider, ConnectionParameters parameters)
			: base (provider, parameters)
		{
		}
 async Task <ISslStream> ISslStreamProvider.CreateClientStreamAsync(Stream stream, string targetHost, ConnectionParameters parameters, CancellationToken cancellationToken)
 {
     return(await CreateClientStreamAsync(stream, targetHost, parameters, cancellationToken).ConfigureAwait(false));
 }
 public Connection(ConnectionParameters parameters, bool insist, IFrameHandler frameHandler)
     : base(parameters, insist, frameHandler) {}
        public async Task <MonoSslStream> CreateClientStreamAsync(Stream stream, string targetHost, ConnectionParameters parameters, MSI.MonoTlsSettings settings, CancellationToken cancellationToken)
        {
            var protocol = GetProtocol(parameters, false);

            CallbackHelpers.AddCertificateValidator(settings, parameters.ClientCertificateValidator);
            CallbackHelpers.AddCertificateSelector(settings, parameters.ClientCertificateSelector);
            var clientCertificates = CallbackHelpers.GetClientCertificates(parameters);

            var sslStream     = tlsProvider.CreateSslStream(stream, false, settings);
            var monoSslStream = new MonoSslStream(sslStream);

            try {
                await sslStream.AuthenticateAsClientAsync(targetHost, clientCertificates, protocol, false).ConfigureAwait(false);
            } catch (Exception ex) {
                var lastError = monoSslStream.LastError;
                if (lastError != null)
                {
                    throw new AggregateException(ex, lastError);
                }
                throw;
            }

            return(monoSslStream);
        }
示例#31
0
		public MonoConnection (MonoConnectionProviderImpl provider, ConnectionParameters parameters)
			: base (provider, parameters)
		{
			this.provider = provider;
		}
 /// <summary>
 /// Argument Constructor
 /// </summary>
 /// <param name="parameters">Contains parametes to create connection</param>
 public ESignalMarketDataProvider(ConnectionParameters parameters)
 {
     _parameters = parameters;
 }
示例#33
0
 /// <summary>
 /// Creates an instance of the plugin.
 /// </summary>
 /// <param name="parms">The connection parameters</param>
 /// <returns>An instance of <see cref="FoscamSdController"/></returns>
 public ICameraPlugin Create(ConnectionParameters parms)
 {
     return(new FoscamSdController(parms));
 }
示例#34
0
		public HttpServer CreateServer (IPortableEndPoint clientAndPoint, IPortableEndPoint listenAddress, ListenerFlags flags, ConnectionParameters parameters = null)
		{
			return new HttpServer (this, clientAndPoint, listenAddress, flags, parameters);
		}
示例#35
0
 public OpenSslClient(OpenSslConnectionProvider provider, ConnectionParameters parameters)
     : base(provider, parameters)
 {
 }
示例#36
0
		public OpenSslServer (OpenSslConnectionProvider provider, ConnectionParameters parameters)
			: base (provider, parameters)
		{
		}
示例#37
0
 public RtspHttpTransportClient(ConnectionParameters connectionParameters)
     : base(connectionParameters)
 {
 }
		public override IServer CreateServer (ConnectionParameters parameters)
		{
			if (SupportsMonoExtensions)
				return new MonoServer (this, parameters);
			else
				return new DotNetServer (this, parameters, this);
		}
        //private NpgsqlConnection Connection;

        /// <summary>
        /// Constructor, initializes a new connection from the ConnectionParameters-object.
        /// </summary>
        /// <param name="connectionParameters">The connection parameters.</param>
        public MPMPostgreSQLConnection(ConnectionParameters connectionParameters)
            : base(connectionParameters)
        {
            DBWorker.SqlCreator = new SQLCreatorPostgres();
        }
		public MonoSslStream CreateServerStream (Stream stream, ConnectionParameters parameters)
		{
			var settings = new MSI.MonoTlsSettings ();
			var certificate = CertificateProvider.GetCertificate (parameters.ServerCertificate);

			var protocol = GetProtocol (parameters, true);
			CallbackHelpers.AddCertificateValidator (settings, parameters.ServerCertificateValidator);

			var askForCert = parameters.AskForClientCertificate || parameters.RequireClientCertificate;

			var sslStream = tlsProvider.CreateSslStream (stream, false, settings);
			sslStream.AuthenticateAsServer (certificate, askForCert, protocol, false);

			return new MonoSslStream (sslStream);
		}
示例#41
0
 public override IConnection CreateConnection(ConnectionParameters parameters,
                                              bool insist,
                                              IFrameHandler frameHandler)
 {
     return(new Connection(parameters, insist, frameHandler));
 }
		public Task<MonoSslStream> CreateServerStreamAsync (Stream stream, ConnectionParameters parameters, CancellationToken cancellationToken)
		{
			return CreateServerStreamAsync (stream, parameters, new MSI.MonoTlsSettings (), cancellationToken);
		}
示例#43
0
        private static bool interrogationHandler(object parameter, ServerConnection connection, ASDU asdu, byte qoi)
        {
            Console.WriteLine("Interrogation for group " + qoi);

            ConnectionParameters cp = connection.GetConnectionParameters();

            connection.SendACT_CON(asdu, false);

            // send information objects
            ASDU newAsdu = new ASDU(cp, CauseOfTransmission.INTERROGATED_BY_STATION, false, false, 2, 1, false);

            newAsdu.AddInformationObject(new MeasuredValueScaled(100, -1, new QualityDescriptor()));

            newAsdu.AddInformationObject(new MeasuredValueScaled(101, 23, new QualityDescriptor()));

            newAsdu.AddInformationObject(new MeasuredValueScaled(102, 2300, new QualityDescriptor()));

            connection.SendASDU(newAsdu);

            newAsdu = new ASDU(cp, CauseOfTransmission.INTERROGATED_BY_STATION, false, false, 3, 1, false);

            newAsdu.AddInformationObject(new MeasuredValueScaledWithCP56Time2a(103, 3456, new QualityDescriptor(), new CP56Time2a(DateTime.Now)));

            connection.SendASDU(newAsdu);

            newAsdu = new ASDU(cp, CauseOfTransmission.INTERROGATED_BY_STATION, false, false, 2, 1, false);

            newAsdu.AddInformationObject(new SinglePointWithCP56Time2a(104, true, new QualityDescriptor(), new CP56Time2a(DateTime.Now)));

            connection.SendASDU(newAsdu);

            // send sequence of information objects
            newAsdu = new ASDU(cp, CauseOfTransmission.INTERROGATED_BY_STATION, false, false, 2, 1, true);

            newAsdu.AddInformationObject(new SinglePointInformation(200, true, new QualityDescriptor()));
            newAsdu.AddInformationObject(new SinglePointInformation(201, false, new QualityDescriptor()));
            newAsdu.AddInformationObject(new SinglePointInformation(202, true, new QualityDescriptor()));
            newAsdu.AddInformationObject(new SinglePointInformation(203, false, new QualityDescriptor()));
            newAsdu.AddInformationObject(new SinglePointInformation(204, true, new QualityDescriptor()));
            newAsdu.AddInformationObject(new SinglePointInformation(205, false, new QualityDescriptor()));
            newAsdu.AddInformationObject(new SinglePointInformation(206, true, new QualityDescriptor()));
            newAsdu.AddInformationObject(new SinglePointInformation(207, false, new QualityDescriptor()));

            connection.SendASDU(newAsdu);

            newAsdu = new ASDU(cp, CauseOfTransmission.INTERROGATED_BY_STATION, false, false, 2, 1, true);

            newAsdu.AddInformationObject(new MeasuredValueNormalizedWithoutQuality(300, -1.0f));
            newAsdu.AddInformationObject(new MeasuredValueNormalizedWithoutQuality(301, -0.5f));
            newAsdu.AddInformationObject(new MeasuredValueNormalizedWithoutQuality(302, -0.1f));
            newAsdu.AddInformationObject(new MeasuredValueNormalizedWithoutQuality(303, .0f));
            newAsdu.AddInformationObject(new MeasuredValueNormalizedWithoutQuality(304, 0.1f));
            newAsdu.AddInformationObject(new MeasuredValueNormalizedWithoutQuality(305, 0.2f));
            newAsdu.AddInformationObject(new MeasuredValueNormalizedWithoutQuality(306, 0.5f));
            newAsdu.AddInformationObject(new MeasuredValueNormalizedWithoutQuality(307, 0.7f));
            newAsdu.AddInformationObject(new MeasuredValueNormalizedWithoutQuality(308, 0.99f));
            newAsdu.AddInformationObject(new MeasuredValueNormalizedWithoutQuality(309, 1f));

            connection.SendASDU(newAsdu);

            connection.SendACT_TERM(asdu);

            return(true);
        }
		async Task<ISslStream> ISslStreamProvider.CreateClientStreamAsync (Stream stream, string targetHost, ConnectionParameters parameters, CancellationToken cancellationToken)
		{
			return await CreateClientStreamAsync (stream, targetHost, parameters, cancellationToken).ConfigureAwait (false);
		}
示例#45
0
        static int Main(string[] args)
        {
            var connection_parameters = new ConnectionParameters();
            var constraints           = new Constraints {
                Resource = new[] { "resource" }
            };
            var    task               = new Task();
            int    interval           = 5000;
            int    number_of_messages = 10;
            Action ensure_credentials = () => { if (connection_parameters.Credentials == null)
                                                {
                                                    connection_parameters.Credentials = new Credentials();
                                                }
            };
            var options = new OptionSet
            {
                { "identifier=", "", identifier => connection_parameters.Identifier = identifier },
                { "host=", "", host => connection_parameters.Host = host },
                { "port=", "", port => connection_parameters.Port = int.Parse(port) },
                { "virtual-host=", "", vhost => connection_parameters.VirtualHost = vhost },
                { "username="******"", username => { ensure_credentials(); connection_parameters.Credentials.UserName = username; } },
                { "password="******"", password => { ensure_credentials(); connection_parameters.Credentials.Password = password; } },
                { "resource=", "", resource => constraints.Resource[0] = resource },
                { "worker=", "", worker => task.Worker = worker },
                { "package=", "", package => task.Package = package },
                { "data=", "", data => task.Data = Encoding.UTF8.GetBytes(data) },
                { "interval=", "", interval_str => interval = int.Parse(interval_str) },
                { "number=", "", number => number_of_messages = int.Parse(number) },
            };

            try
            {
                options.Parse(args);
            }
            catch (OptionException e)
            {
                Console.WriteLine("Argument error: {0}", e.Message);
            }
            var listener = new ClientListener(connection_parameters);
            var sender   = new ClientSender(connection_parameters);

            listener.Listen((id, status) =>
            {
                Console.WriteLine("Got status: id = {0}, status = [{1}, {2}] {3}",
                                  id, status.Code, status.Reason,
                                  status.Data != null ? Encoding.ASCII.GetString(status.Data) : "null");
            }, (id, result) =>
            {
                Console.WriteLine("Got result: id = {0}, result = [{1}, {2}] {3}",
                                  id, result.Status, result.Reason,
                                  result.Data != null ? Encoding.ASCII.GetString(result.Data) : "null");
            }, (id, error) =>
            {
                Console.WriteLine("Got error: id = {0}, error = {1}", id, error);
            });
            for (int id = 0; id < number_of_messages; ++id)
            {
                sender.Send(constraints, id.ToString(), task);
                Thread.Sleep(interval);
            }
            listener.Close();
            sender.Close();
            return(0);
        }
		public async Task<MonoSslStream> CreateClientStreamAsync (Stream stream, string targetHost, ConnectionParameters parameters, MSI.MonoTlsSettings settings, CancellationToken cancellationToken)
		{
			var protocol = GetProtocol (parameters, false);

			CallbackHelpers.AddCertificateValidator (settings, parameters.ClientCertificateValidator);
			CallbackHelpers.AddCertificateSelector (settings, parameters.ClientCertificateSelector);
			var clientCertificates = CallbackHelpers.GetClientCertificates (parameters);

			var sslStream = tlsProvider.CreateSslStream (stream, false, settings);
			var monoSslStream = new MonoSslStream (sslStream);

			try {
				await sslStream.AuthenticateAsClientAsync (targetHost, clientCertificates, protocol, false).ConfigureAwait (false);
			} catch (Exception ex) {
				var lastError = monoSslStream.LastError;
				if (lastError != null)
					throw new AggregateException (ex, lastError);
				throw;
			}

			return monoSslStream;
		}
示例#47
0
 public void Initialize(ConnectionParameters connectionParameters)
 {
     commandLineArgs.TryGetCommandLineValue(RuntimeConfigNames.LinkProtocol,
                                            ref connectionParameters.Network.ConnectionType);
 }
 /// <summary>
 /// Contructor, initializes a new connection from the ConnectionParameters-object.
 /// </summary>
 /// <param Name="ConnectionParameters">The connection parameters.</param>
 public MySQLConnection(ConnectionParameters conParams)
 {
     this.conParams = conParams;
     Initialize(conParams.Host, conParams.Database, conParams.User, conParams.Password, conParams.Port);
 }
 ISslStream ISslStreamProvider.CreateServerStream(Stream stream, ConnectionParameters parameters)
 {
     return(CreateServerStream(stream, parameters));
 }
示例#50
0
		public OpenSslConnection (OpenSslConnectionProvider provider, ConnectionParameters parameters)
			: base (GetEndPoint (parameters), parameters)
		{
			this.provider = provider;
			createTcs = new TaskCompletionSource<object> ();
		}
 async Task <ISslStream> ISslStreamProvider.CreateServerStreamAsync(Stream stream, ConnectionParameters parameters, CancellationToken cancellationToken)
 {
     return(await CreateServerStreamAsync(stream, parameters, cancellationToken).ConfigureAwait(false));
 }
		public override IServer CreateServer (ConnectionParameters parameters)
		{
			return new OpenSslServer (this, parameters);
		}
 public Task <MonoSslStream> CreateServerStreamAsync(Stream stream, ConnectionParameters parameters, CancellationToken cancellationToken)
 {
     return(CreateServerStreamAsync(stream, parameters, new MSI.MonoTlsSettings(), cancellationToken));
 }
		SslProtocols GetProtocol (ConnectionParameters parameters, bool server)
		{
			var protocol = (ProtocolVersions)tlsProvider.SupportedProtocols;
			protocol &= server ? ProtocolVersions.ServerMask : ProtocolVersions.ClientMask;
			if (parameters.ProtocolVersion != null)
				protocol &= parameters.ProtocolVersion;
			if (protocol == ProtocolVersions.Unspecified)
				throw new NotSupportedException ();
			return (SslProtocols)protocol;
		}
示例#55
0
 protected override ConnectionParameters MakeDefaultSessionConnectParams(IConfigSectionNode paramsSection)
 {
     return(ConnectionParameters.Make <PayPalConnectionParameters>(paramsSection));
 }