sm_x509cmn.h   [plain text]


//   NOTE: this is a machine generated file--editing not recommended
//
// sm_x509cmn.h - class definitions for ASN.1 module CommonX509Definitions
//
//   This file was generated by snacc on Wed Jun 27 16:40:55 2001
//   UBC snacc by Mike Sample
//   A couple of enhancements made by IBM European Networking Center

#ifndef _sm_x509cmn_h_
#define _sm_x509cmn_h_


//------------------------------------------------------------------------------
// class declarations:

class EDIPartyName;
class GeneralName;
class GeneralNames;

//------------------------------------------------------------------------------
// class definitions:

/* OBJECT IDENTIFIER */
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);
  int			BEncPdu (BUF_TYPE b, AsnLen &bytesEncoded);
  int			BDecPdu (BUF_TYPE b, AsnLen &bytesDecoded);

  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);
  int			BEncPdu (BUF_TYPE b, AsnLen &bytesEncoded);
  int			BDecPdu (BUF_TYPE b, AsnLen &bytesDecoded);

  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; }
  // reading member fcns
  int			Count() const	{ return count; }
  // NOTE: if your compiler complains about these NULLs, its definition of NULL is broken (and you better change it there!)
  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; }

  // routines that move the curr elmt
  GeneralName	*GoNext() { if (curr) curr = curr->next; return Curr(); }
  GeneralName	*GoPrev() { if (curr) curr = curr->prev; return Curr(); }

  // write & alloc fcns - returns new elmt
  GeneralName	*Append();  // add elmt to end of list
  GeneralName	*Prepend(); // add elmt to beginning of list
  GeneralName	*InsertBefore(); //insert elmt before current elmt
  GeneralName	*InsertAfter(); //insert elmt after current elmt

  // write & alloc & copy - returns list after copying elmt
  GeneralNames	&AppendCopy (GeneralName &elmt);  // add elmt to end of list
  GeneralNames	&PrependCopy (GeneralName &elmt); // add elmt to beginning of list
  GeneralNames	&InsertBeforeAndCopy (GeneralName &elmt); //insert elmt before current elmt
  GeneralNames	&InsertAfterAndCopy (GeneralName &elmt); //insert elmt after current elmt

  // removing the current elmt from the list
  void		RemoveCurrFromList();

  // encode and decode routines    
  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;
};


//------------------------------------------------------------------------------
// externs for value defs

//------------------------------------------------------------------------------

#endif /* conditional include of sm_x509cmn.h */