#ifndef _sm_x509cmn_h_
#define _sm_x509cmn_h_
class EDIPartyName;
class GeneralName;
class GeneralNames;
typedef AsnOid OTHER_NAME;
class EDIPartyName: public AsnType
{
public:
DirectoryString *nameAssigner;
DirectoryString *partyName;
EDIPartyName();
EDIPartyName (const EDIPartyName &);
virtual ~EDIPartyName();
virtual AsnType *Clone() const;
virtual AsnType *Copy() const;
EDIPartyName &operator = (const EDIPartyName &);
AsnLen BEncContent (BUF_TYPE b);
void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
AsnLen BEnc (BUF_TYPE b);
void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
void Print (ostream &os) const;
};
class GeneralName: public AsnType
{
public:
enum ChoiceIdEnum
{
otherNameCid = 0,
rfc822NameCid = 1,
dNSNameCid = 2,
x400AddressCid = 3,
directoryNameCid = 4,
ediPartyNameCid = 5,
uniformResourceIdentifierCid = 6,
iPAddressCid = 7,
registeredIDCid = 8
};
enum ChoiceIdEnum choiceId;
union
{
OTHER_NAME *otherName;
IA5String *rfc822Name;
IA5String *dNSName;
ORAddress *x400Address;
Name *directoryName;
EDIPartyName *ediPartyName;
IA5String *uniformResourceIdentifier;
AsnOcts *iPAddress;
AsnOid *registeredID;
};
GeneralName();
GeneralName (const GeneralName &);
virtual ~GeneralName();
virtual AsnType *Clone() const;
virtual AsnType *Copy() const;
GeneralName &operator = (const GeneralName &);
AsnLen BEncContent (BUF_TYPE b);
void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
AsnLen BEnc (BUF_TYPE b);
void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
void Print (ostream &os) const;
};
class GeneralNames: public AsnType
{
protected:
unsigned long int count;
struct AsnListElmt
{
AsnListElmt *next;
AsnListElmt *prev;
GeneralName *elmt;
} *first, *curr, *last;
public:
GeneralNames() { count = 0; first = curr = last = NULL; }
GeneralNames (const GeneralNames &);
virtual ~GeneralNames();
virtual AsnType *Clone() const;
virtual AsnType *Copy() const;
GeneralNames &operator = (const GeneralNames &);
void SetCurrElmt (unsigned long int index);
unsigned long int GetCurrElmtIndex();
void SetCurrToFirst() { curr = first; }
void SetCurrToLast() { curr = last; }
int Count() const { return count; }
GeneralName *First() const { return count > 0 ? first->elmt : NULL; }
GeneralName *Last() const { return count > 0 ? last->elmt : NULL; }
GeneralName *Curr() const { return curr ? curr->elmt : NULL; }
GeneralName *Next() const { return curr && curr->next ? curr->next->elmt : NULL; }
GeneralName *Prev() const { return curr && curr->prev ? curr->prev->elmt : NULL; }
GeneralName *GoNext() { if (curr) curr = curr->next; return Curr(); }
GeneralName *GoPrev() { if (curr) curr = curr->prev; return Curr(); }
GeneralName *Append(); GeneralName *Prepend(); GeneralName *InsertBefore(); GeneralName *InsertAfter();
GeneralNames &AppendCopy (GeneralName &elmt); GeneralNames &PrependCopy (GeneralName &elmt); GeneralNames &InsertBeforeAndCopy (GeneralName &elmt); GeneralNames &InsertAfterAndCopy (GeneralName &elmt);
void RemoveCurrFromList();
AsnLen BEnc (BUF_TYPE b);
void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
AsnLen BEncContent (BUF_TYPE b);
void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
PDU_MEMBER_MACROS
void Print (ostream &os) const;
};
#endif