//   NOTE: this is a machine generated file--editing not recommended
//
// rfc1157-snmp.h - class definitions for ASN.1 module RFC1157-SNMP
//
//   This file was generated by snacc on Mon May 25 16:21:56 1998
//   UBC snacc by Mike Sample
//   A couple of enhancements made by IBM European Networking Center

#ifndef _rfc1157_snmp_h_
#define _rfc1157_snmp_h_


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

class Trap_PDUInt;
class PDUInt;
class MessageInt;
class VarBind;
class VarBindList;
class PDU;
class Trap_PDU;
class GetRequest_PDU;
class GetNextRequest_PDU;
class GetResponse_PDU;
class SetRequest_PDU;
class PDUs;
class Message;

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

/* INTEGER { coldStart (0), warmStart (1), linkDown (2), linkUp (3), authenticationFailure (4), egpNeighborLoss (5), enterpriseSpecific (6) }  */
class Trap_PDUInt: public AsnInt
{
public:
			Trap_PDUInt(): AsnInt() {}
			Trap_PDUInt (int i): AsnInt (i) {}
  enum
  {
    coldStart = 0,
    warmStart = 1,
    linkDown = 2,
    linkUp = 3,
    authenticationFailure = 4,
    egpNeighborLoss = 5,
    enterpriseSpecific = 6
  };
};


/* INTEGER { noError (0), tooBig (1), noSuchName (2), badValue (3), readOnly (4), genErr (5) }  */
class PDUInt: public AsnInt
{
public:
			PDUInt(): AsnInt() {}
			PDUInt (int i): AsnInt (i) {}
  enum
  {
    noError = 0,
    tooBig = 1,
    noSuchName = 2,
    badValue = 3,
    readOnly = 4,
    genErr = 5
  };
};


/* INTEGER { version_1 (0) }  */
class MessageInt: public AsnInt
{
public:
			MessageInt(): AsnInt() {}
			MessageInt (int i): AsnInt (i) {}
  enum
  {
    version_1 = 0
  };
};


class VarBind: public AsnType
{
public:
  ObjectName		name;
  ObjectSyntax		*value;

			VarBind();
			VarBind (const VarBind &);
			~VarBind();
  AsnType		*Clone() const;

  VarBind		&operator = (const VarBind &);
  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 VarBindList: public AsnType
{
protected:
  unsigned long int	count;
  struct AsnListElmt
  {
    AsnListElmt	*next;
    AsnListElmt	*prev;
    VarBind	*elmt;
  }			*first, *curr, *last;

public:
			VarBindList() { count = 0; first = curr = last = NULL; }
			VarBindList (const VarBindList &);
			~VarBindList();
  AsnType		*Clone() const;

  VarBindList		&operator = (const VarBindList &);
  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!)
  VarBind	*First() const	{ return count > 0 ? first->elmt : NULL; }
  VarBind	*Last() const	{ return count > 0 ? last->elmt : NULL; }
  VarBind	*Curr() const	{ return curr ? curr->elmt : NULL; }
  VarBind	*Next() const	{ return curr && curr->next ? curr->next->elmt : NULL; }
  VarBind	*Prev() const	{ return curr && curr->prev ? curr->prev->elmt : NULL; }

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

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

  // write & alloc & copy - returns list after copying elmt
  VarBindList	&AppendCopy (VarBind &elmt);  // add elmt to end of list
  VarBindList	&PrependCopy (VarBind &elmt); // add elmt to beginning of list
  VarBindList	&InsertBeforeAndCopy (VarBind &elmt); //insert elmt before current elmt
  VarBindList	&InsertAfterAndCopy (VarBind &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;
};


class PDU: public AsnType
{
public:
  AsnInt		request_id;
  PDUInt		error_status;
  AsnInt		error_index;
  VarBindList		variable_bindings;

			PDU();
			PDU (const PDU &);
			~PDU();
  AsnType		*Clone() const;

  PDU		&operator = (const PDU &);
  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 Trap_PDU: public AsnType
{
public:
  AsnOid		enterprise;
  NetworkAddress		*agent_addr;
  Trap_PDUInt		generic_trap;
  AsnInt		specific_trap;
  TimeTicks		time_stamp;
  VarBindList		variable_bindings;

			Trap_PDU();
			Trap_PDU (const Trap_PDU &);
			~Trap_PDU();
  AsnType		*Clone() const;

  Trap_PDU		&operator = (const Trap_PDU &);
  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;
};


/* [0] IMPLICIT PDU */
class GetRequest_PDU: public PDU
{
public:
			GetRequest_PDU(): PDU() {}
  AsnType		*Clone() const;

  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);

};


/* [1] IMPLICIT PDU */
class GetNextRequest_PDU: public PDU
{
public:
			GetNextRequest_PDU(): PDU() {}
  AsnType		*Clone() const;

  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);

};


/* [2] IMPLICIT PDU */
class GetResponse_PDU: public PDU
{
public:
			GetResponse_PDU(): PDU() {}
  AsnType		*Clone() const;

  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);

};


/* [3] IMPLICIT PDU */
class SetRequest_PDU: public PDU
{
public:
			SetRequest_PDU(): PDU() {}
  AsnType		*Clone() const;

  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);

};


class PDUs: public AsnType
{
public:
  enum ChoiceIdEnum
  {
     get_requestCid = 0,
     get_next_requestCid = 1,
     get_responseCid = 2,
     set_requestCid = 3,
     trapCid = 4
  };

  enum ChoiceIdEnum	choiceId;
  union
  {
     GetRequest_PDU		*get_request;
     GetNextRequest_PDU		*get_next_request;
     GetResponse_PDU		*get_response;
     SetRequest_PDU		*set_request;
     Trap_PDU		*trap;
  };


			PDUs();
			PDUs (const PDUs &);
			~PDUs();

  AsnType		*Clone() const;

  PDUs		&operator = (const PDUs &);
  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 Message: public AsnType
{
public:
  MessageInt		version;
  AsnOcts		community;
  PDUs		*data;

			Message();
			Message (const Message &);
			~Message();
  AsnType		*Clone() const;

  Message		&operator = (const Message &);
  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;
};


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

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

#endif /* conditional include of rfc1157-snmp.h */
