Пример #1
0
            public static long saHpiSessionOpen(
                long DomainId,
                out long SessionId,
                Object SecurityParams
                )
            {
                long rv;
                bool rc;

                SessionId = 0;

                if (SecurityParams != null)
                {
                    return(HpiConst.SA_ERR_HPI_INVALID_PARAMS);
                }

                HpiSession s = HpiCore.CreateSession(DomainId);

                if (s == null)
                {
                    return(HpiConst.SA_ERR_HPI_INVALID_DOMAIN);
                }
                OhpiMarshal m = s.GetMarshal();

                if (m == null)
                {
                    HpiCore.RemoveSession(s);
                    return(HpiConst.SA_ERR_HPI_NO_RESPONSE);
                }

                m.MarshalSaHpiDomainIdT(s.GetRemoteDid());
                rc = m.Interchange(OhpiConst.RPC_SAHPI_SESSION_OPEN);
                if (!rc)
                {
                    m.Close();
                    HpiCore.RemoveSession(s);
                    return(HpiConst.SA_ERR_HPI_NO_RESPONSE);
                }
                rv = m.DemarshalSaErrorT();
                if (rv == HpiConst.SA_OK)
                {
                    SessionId = m.DemarshalSaHpiSessionIdT();
                    s.SetRemoteSid(SessionId);
                    SessionId = s.GetLocalSid();
                }
                s.PutMarshal(m);
                if (rv != HpiConst.SA_OK)
                {
                    HpiCore.RemoveSession(s);
                }

                return(rv);
            }