/*********************************************************************** * * Copyright (C) 2005-2006 Novell, Inc. All Rights Reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; version 2.1 * of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, Novell, Inc. * * To contact Novell about this file by physical or electronic mail, * you may find current contact information at www.novell.com. * ***********************************************************************/ using System; using System.Text; namespace Novell.CASA.MiCasa.Common { /// /// Summary description for MessageObject. /// /// [Serializable] public class WrappedObject { public static string DEFAULT_KEYCHAIN_ID = "SSCS_SESSION_KEY_CHAIN_ID\0"; private int m_verb = 0; private string m_KeychainID = null; private string m_SecretID = null; private string m_KeyID = null; private object m_object; private int m_rcode = 0; private string m_errorMsg; public WrappedObject(int rcode, string errorMsg) { m_rcode = rcode; m_errorMsg = errorMsg; } public WrappedObject(int verb, string sKeychainID, string sSecretID, string sKeyID, object theObject) { m_verb = verb; if (sKeychainID != null) m_KeychainID = sKeychainID + '\0'; else m_KeychainID = DEFAULT_KEYCHAIN_ID; if (sSecretID != null) { if (sSecretID.StartsWith("SS_CredSet")) m_SecretID = "SS_CredSet:" + Utils.EscapeReservedChars(sSecretID.Substring(11)) + '\0'; else m_SecretID = "SS_CredSet:" + Utils.EscapeReservedChars(sSecretID) + '\0'; } if (sKeyID != null) m_KeyID = Utils.EscapeReservedChars(sKeyID); // + '\0'; // serialize the object m_object = theObject; } public string GetKeyID() { return m_KeyID; } public string GetSecretID() { return m_SecretID; } public string GetKeychainID() { return m_KeychainID; } public object GetObject() { return m_object; } public void SetObject(object theobject) { m_object = theobject; } public int GetAction() { return m_verb; } public void SetError(int rcode, string message) { m_rcode = rcode; m_errorMsg = message; } public int GetReturnCode() { return m_rcode; } public string GetReturnMessage() { return m_errorMsg; } } }