Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

EstablishedMsg.cc

00001 /*
00002  * Copyright 2003 Michael A. Marsh, Cornell University. All rights reserved.
00003  * This software is released under the modified BSD license.
00004  * See the file LICENSE in the top-level directory for details.
00005  */
00006 //
00007 // $Id: EstablishedMsg.cc,v 1.3 2004/05/19 15:56:23 mmarsh Exp $
00008 //
00009 // $Log: EstablishedMsg.cc,v $
00010 // Revision 1.3  2004/05/19 15:56:23  mmarsh
00011 // Added copyright and license statements.
00012 //
00013 // Revision 1.2  2003/11/04 22:31:45  mmarsh
00014 // *** empty log message ***
00015 //
00016 //
00017 
00018 #include "Message.h"
00019 
00020 using namespace CODEX_APSS;
00021 
00022 EstablishedMsg::EstablishedMsg() :
00023    Message( false )
00024 {
00025 }
00026 
00027 EstablishedMsg::EstablishedMsg( const EstablishMsg& request ) :
00028    Message( true ),
00029    m_version( request.version() ),
00030    m_sublabel( request.sublabel() ),
00031    m_recipient( request.recipient() ),
00032    m_establisher( request.establisher() )
00033 {
00034 }
00035 
00036 EstablishedMsg::EstablishedMsg( const EstablishedMsg& aOther ) :
00037    Message( aOther.m_initialized ),
00038    m_version( aOther.m_version ),
00039    m_sublabel( aOther.m_sublabel ),
00040    m_recipient( aOther.m_recipient ),
00041    m_establisher( aOther.m_establisher )
00042 {
00043 }
00044 
00045 void
00046 EstablishedMsg::operator=( const EstablishedMsg& aOther )
00047 {
00048    m_initialized = aOther.m_initialized;
00049    m_version = aOther.m_version;
00050    m_sublabel = aOther.m_sublabel;
00051    m_recipient = aOther.m_recipient;
00052    m_establisher = aOther.m_establisher;
00053 }
00054 
00055 int
00056 EstablishedMsg::marshal( unsigned char ** pp ) const
00057 {
00058    int r=0;
00059    int ret=0;
00060    unsigned char * p;
00061 
00062    ret += m_version.marshal(0);
00063    ret += m_sublabel.marshal(0);
00064    ret += m_recipient.marshal(0);
00065    ret += m_establisher.marshal(0);
00066    M_ASN1_I2D_seq_total();
00067    m_version.marshal(&p);
00068    m_sublabel.marshal(&p);
00069    m_recipient.marshal(&p);
00070    m_establisher.marshal(&p);
00071    M_ASN1_I2D_finish();
00072 }
00073 
00074 void*
00075 EstablishedMsg::unmarshal( void* bogus, unsigned char ** pp, long length )
00076 {
00077    if ( m_initialized )
00078    {
00079       return NULL;
00080    }
00081    if ( (NULL == pp) || (NULL == *pp) )
00082    {
00083       return NULL;
00084    }
00085    ASN1_CTX c;
00086    c.pp = pp;
00087    c.q = *pp;
00088    c.error = ERR_R_NESTED_ASN1_ERROR;
00089    int i;
00090 
00091    M_ASN1_D2I_Init();
00092    M_ASN1_D2I_start_sequence();
00093    M_ASN1_D2I_get(i, m_version.unmarshal);
00094    M_ASN1_D2I_get(i, m_sublabel.unmarshal);
00095    M_ASN1_D2I_get(i, m_recipient.unmarshal);
00096    M_ASN1_D2I_get(i, m_establisher.unmarshal);
00097    if ( !asn1_Finish(&c) )
00098    {
00099       return NULL;
00100    }
00101    *pp=c.p;
00102    m_initialized = true;
00103    return this;
00104   err: // needed by ASN.1 macros
00105    return NULL;
00106 }

Generated on Fri May 6 17:39:12 2005 for COrnell Data EXchange (CODEX) by  doxygen 1.4.1