Ejemplo n.º 1
0
        void init(IsoAcse.AcseAuthenticationParameter acseAuthPar)
        {
            // Defaults
            hostname = "localhost";
            port     = 102;

            IsoCotp.TSelector selector1 = new IsoCotp.TSelector(2, 0);
            IsoCotp.TSelector selector2 = new IsoCotp.TSelector(2, 1);
            setLocalAddresses(1, 1, selector1);
            setLocalApTitle("1.1.1.999", 12);
            setRemoteAddresses(1, 1, selector2);
            setRemoteApTitle("1.1.1.999.1", 12);
            acseAuthParameter = acseAuthPar;
        }
Ejemplo n.º 2
0
        public IsoConnectionParameters(StringDictionary stringDictionary)
        {
            init(null);
            int remoteTSelectorVal  = remoteTSelector.value;
            int remoteTSelectorSize = remoteTSelector.value;

            foreach (string key in stringDictionary.Keys)
            {
                switch (key.ToLower())
                {
                case "hostname":
                    hostname = stringDictionary[key];
                    break;

                case "port":
                    int.TryParse(stringDictionary[key], out port);
                    break;

                case "remoteaptitle":
                    remoteApTitleS   = stringDictionary[key];
                    remoteApTitleLen = IsoUtil.BerEncoder_encodeOIDToBuffer(remoteApTitleS, remoteApTitle, 10);
                    break;

                case "remoteaequalifier":
                    int.TryParse(stringDictionary[key], out remoteAEQualifier);
                    break;

                case "remotepselector":
                    uint.TryParse(stringDictionary[key], out remotePSelector);
                    break;

                case "remotesselector":
                    ushort.TryParse(stringDictionary[key], out remoteSSelector);
                    break;

                case "remotetselectorvalue":
                    int.TryParse(stringDictionary[key], out remoteTSelector.value);
                    break;

                case "remotetselectorsize":
                    byte.TryParse(stringDictionary[key], out remoteTSelector.size);
                    break;

                case "localaptitle":
                    localApTitleS   = stringDictionary[key];
                    localApTitleLen = IsoUtil.BerEncoder_encodeOIDToBuffer(localApTitleS, localApTitle, 10);
                    break;

                case "localaequalifier":
                    int.TryParse(stringDictionary[key], out localAEQualifier);
                    break;

                case "localpselector":
                    uint.TryParse(stringDictionary[key], out localPSelector);
                    break;

                case "localsselector":
                    ushort.TryParse(stringDictionary[key], out localSSelector);
                    break;

                case "localtselectorvalue":
                    int.TryParse(stringDictionary[key], out localTSelector.value);
                    break;

                case "localtselectorsize":
                    byte.TryParse(stringDictionary[key], out localTSelector.size);
                    break;

                case "authenticationmechanism":
                    if (acseAuthParameter == null)
                    {
                        acseAuthParameter = new IsoAcse.AcseAuthenticationParameter();
                    }
                    Enum.TryParse <IsoAcse.AcseAuthenticationMechanism>(stringDictionary[key], out acseAuthParameter.mechanism);
                    break;

                case "authenticationpassword":
                    if (acseAuthParameter == null)
                    {
                        acseAuthParameter = new IsoAcse.AcseAuthenticationParameter();
                    }
                    acseAuthParameter.password           = stringDictionary[key];
                    acseAuthParameter.paswordOctetString = Encoding.ASCII.GetBytes(acseAuthParameter.password);
                    acseAuthParameter.passwordLength     = acseAuthParameter.paswordOctetString.Length;
                    break;
                }
            }
        }
Ejemplo n.º 3
0
 public IsoConnectionParameters(IsoAcse.AcseAuthenticationParameter acseAuthPar)
 {
     init(acseAuthPar);
 }