/*
 *  Copyright (c) 1996-2007 Digi International Inc., All Rights Reserved
 *
 *  This software contains proprietary and confidential information of Digi
 *  International Inc.  By accepting transfer of this copy, Recipient agrees
 *  to retain this software in confidence, to prevent disclosure to others,
 *  and to make no use of this software other than that for which it was
 *  delivered.  This is an unpublished copyrighted work of Digi International
 *  Inc.  Except as permitted by federal law, 17 USC 117, copying is strictly
 *  prohibited.
 *
 *  Restricted Rights Legend
 *
 *  Use, duplication, or disclosure by the Government is subject to
 *  restrictions set forth in sub-paragraph (c)(1)(ii) of The Rights in
 *  Technical Data and Computer Software clause at DFARS 252.227-7031 or
 *  subparagraphs (c)(1) and (2) of the Commercial Computer Software -
 *  Restricted Rights at 48 CFR 52.227-19, as applicable.
 *
 *  Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
 *
 * =======================================================================
 *  This header file contains declarations used by the Management API
 *  SNMP agent code.
 *
 *
 *
 * Edit Date/Ver   Edit Description
 * ==============  =======================================================
 *
 *
 */

#ifndef man_agnt_h

#define man_agnt_h

#include <Npttypes.h>
#include <man_api.h>
#include <asn1.h>
#include <snmpimpl.h>
#include <snmp.h>
#include <snmpvars.h>
#ifdef __cplusplus
extern "C"
{
#endif

#define MAX_OID_LENGTH      128
#define MAX_STRING_LENGTH   255


#define IE_ZERO             0           /* is a scalar value*/
#define IE_UNKNOWN          1           /* unknown type (should never get this)*/
#define IE_INTEGER          2           /* is simple integer*/
#define IE_IVSTRING         3           /* variable length string with implied ordering*/
#define IE_VSTRING          4           /* variable length string */
#define IE_nIVSTRING        5           /* variable length string with min length and implied ordering*/
#define IE_nVSTRING         6           /* variable length string with min length*/
#define IE_nnIVSTRING       7           /* var length string with min and max length and implied ordering*/
#define IE_nnVSTRING        8           /* var length string with min and max length */
#define IE_nFSTRING         9           /* fixed length string with length*/
#define IE_IOID             10          /* OID with implied ordering*/
#define IE_OID              11          /* OID*/
#define IE_NADDR            12          /* network address, first byte is 1, next 4 are IP address*/
#define IE_IP               13          /* 4 bytes that are IP address*/
#define IE_NSAP             14          /* illegal type that is encoded as an octet string*/


/*ad*
 * These constants identify trap types.
 *
 * @since 5.0
 * @external
 * @category SNMP
 * @see @link snmpAgentTrapType
 * @name TrapTypes "SNMP Trap Types"
 *
 * @param TRAP_TYPE             SNMP version 1 trap
 * @param NOTIFICATION_TYPE     SNMP version 2 notification
*ad*/
#define TRAP_TYPE           0           /* Version 1 trap */
#define NOTIFICATION_TYPE   1           /* Version 2 notification */


/*
 * Used in call to snmpExtractIndices().  That function has to use parameter passed
 * in by Cliff's code.  As usual, he encodes the parameters differently for each
 * possible case.
 */
#define IS_READ         1
#define IS_WRITE        0


/*
 * Lookup table to convert management API errors into equivalent SNMP errors.
 */
extern int snmpErrorLookup[]; 




/*
 * This structure is used to store information about
 * a specific index.  We store the identifier of the item,
 * an integer constant that defines it's encoding, and its
 * minimum and maximum lengths if it is a string.  The pos
 * field indicates what position the index will have in the
 * OID value that identifies the instance of the item.
 */
typedef struct
{
    int instanceEncoding;               /* determines how value is encoded*/
    int min;                            /* minimum length of value*/
    int max;                            /* maximum length of value*/
} snmpAgentIndexListType;



/*
 * This structure is used to store information about
 * the indices of a MIB item.  The indices are columnar items
 * in one or more tables.  
 */
typedef struct 
{
    int indexCount;                     /* total number of indices*/
    snmpAgentIndexListType *list;    /* raw list of indices*/
} snmpAgentIndexInfoType;



/*ad*
 * This structure is used to store information about a variable referenced in a trap.
 *
 * @since 5.0
 * @external
 * @category SNMP
 * @see @link snmpAgentTrapType
 *
 * @param id              ID of variable (usually the OID)
 * @param hintCode        hint code for Fusion agent if it is a field in a table
 * @param oid             OID as a string
 * @param type            Fusion agent type for variable
 *
*ad*/
typedef struct
{
    char * id;                          /* id of variable*/
    int hintCode;                       /* hint code if it is a field in a table*/
    char * oid;                         /* OID as a string*/
    int type;                           /* Fusion agent type for variable*/
} snmpAgentTrapVarType;


/*ad*
 * This structure is used to store information about a specific trap.
 * MIBMAN generates a structure with this information for each trap defined
 * in the MIBs it processes.  The structure is not directly passed to 
 * another function, but
 * just provides information that may be useful to software that implements
 * the trap.
 *
 * @since 5.0
 * @external
 * @category SNMP
 * @see @link snmpAgentTrapVarType
 *
 * @param name                         name for this trap as specified in MIB
 * @param id                           OID for this trap as a character string
 * @param trapNumber                   trap number as specified in MIB
 * @param trapType                     indicates type of type: TRAP_TYPE or NOTIFICATION_TYPE
 * @param variableCount                number of variables to send with this trap
 * @param varList                      list of variables to send with this trap
*ad*/
typedef struct
{
    char * name;                        /* name for this trap*/
    char * id;                          /* id for this trap*/
    int trapNumber;                     /* trap number */
    int trapType;                       /* SMI-1 TRAP or SMI-2 Notification */
    int variableCount;                  /* number of variables to send with this trap*/
    snmpAgentTrapVarType * varList;     /* list of variables to send with this trap*/
} snmpAgentTrapType;



/*
 * This structure is used to create a lookup table that translates between user
 * provided IDs for variables and oids.
 */
typedef struct
{
    char *oid;                          /* OID for variable*/
    char *id;                           /* id that user provides*/
} snmpAgentIdLookupTableType;



/*
 * This structure is used to store information about a specific range.  The
 * range may be two integers that indicate the beginning and end of an allowed
 * range of values, or be a single value that is allowed.
 */
typedef struct
{
    int isSingleton;                    /* set if this is a single range*/
    long min;                           /* minimum value of range, */
                                        /* or single value if isSingleton is set*/
    long max;                           /* maximum value of range*/
} snmpAgentRangeList;




/*
 * This structure is used to store a pointer to an array of snmpAgentRangeList
 * structures.  The entire array stores all of the range information for a variable.
 */
typedef struct
{
    int rangeCount;                     /* number of snmpAgentRangeList elements*/
    snmpAgentRangeList *range;          /* pointer to a list of ranges*/
} snmpAgentRangeType;


/*ad*
 * Structure used to store raw index values for a table object.  The
 * index values were encoded as part of an OID by the console.
 *
 * @external
 * @category SNMP
 * @since 6.0
 *
 * @param type		indicates type of union field
 * @param oidLength	hold length of OID if OID value
 * @param intValue  holds value if index is numeric 
 * @param stringValue   holds value if index is a string
 * @param oidValue      holds value if index is an OID
 * @param ipAddressValue holds value if index is an IP address
 * @param value     union of intValue, stringValue, oldValue, and ipAddressValue
*ad*/
typedef struct
{
    int type;
    
    int oidLength;                          
    union 
    {
        WORD32 intValue;                    /* holds value for numeric index*/
        MAN_OCTET_STRING_TYPE stringValue;  /* holds value for string index*/
        oid * oidValue;                     /* holds value for OID index*/
        WORD8 ipAddressValue[4];            /* holds value for network address index*/
    } value;
} snmpIndexComponent;

/*
 * Type codes for type field in snmpIndexComponent structures.  
 */
#define SNMP_INT_INDEX              0
#define SNMP_STRING_INDEX           1
#define SNMP_STRING_INDEX_WITH_LEN  2
#define SNMP_OID_INDEX              3
#define SNMP_OID_INDEX_WITH_LEN     4
#define SNMP_ADDRESS_INDEX          5

/*ad*
 * structure used to hold an array of snmpIndexComponent values.
 *
 * @external
 * @category SNMP
 * @since 6.0
 *
 * @param numberIndices		number of indices
 * @param isNullIndex		set if NULL indices
 * @param index 		array of indices
 *
 * @see @link snmpIndexComponent
*ad*/
typedef struct
{
    int numberIndices;                  
    int isNullIndex;                    
    snmpIndexComponent *index;          
} snmpIndexType;




/*
 * Lookup table used to translate between user supplied IDs and OIDs.
 * OIDs will be used as identifiers for any MIB items that are not
 * in this table.
 */
extern snmpAgentIdLookupTableType snmpAgentIdLookupTable[];

/*
 * Number of items in look up table.
 */
extern const int snmpAgentIdLookupTableSize;




/*
 *
 *  Function: int snmpInitRow(manVarType *manInfo, manTableIndexType *index, int sizeofRow, int isInsert, void **row);
 *
 *  Description:
 *
 *      This routine initializes a row for a write operation.
 *
 *      1.  The row buffer is allocated.
 *      2.  The current value of the row is read into the buffer.
 *      3.  isInsert is set to reflect whether or not a row already exists at the specified index.
 *
 *  Parameters:
 *
 *      manInfo     information about the row
 *      index       index of row to read
 *      sizeofRow   size of buffer needed for row
 *      row         pointer to pointer for buffer
 *
 *  Return Values:
 *
 *      SNMP_ERR_NOERROR            
 *      SNMP_ERR_GENERR             
 *      SNMP_ERR_NOACCESS           
 *      SNMP_ERR_RESOURCEUNAVAILABLE
 *
 */

int snmpInitRow(manVarType *manInfo, manTableIndexType *rowIndex, int sizeofRow, int *isInsert, void **row);






/*
 *
 *  Function: manVarType *snmpGetVariableInfo (struct variable *vp)
 *
 *  Description:
 *
 *      Returns a pointer to the management API's registration
 *      information about the variable that represents a MIB object.
 *      This information should be treated as read only.
 *
 *  Parameters:
 *
 *      vp          pointer to SNMP agent's info about the MIB object
 *
 *  Return Values:
 *
 *      pointer to management API's registration info on the variable
 *
 */

manVarType *snmpGetVariableInfo (struct variable *vp);





/*
 *
 *  Function: MAN_ID_TYPE snmpGetVariableIdentifier(struct variable *vp)
 *
 *  Description:
 *
 *      This function returns the ID of the management variable that
 *      represents the MIB object in the management database.
 *
 *  Parameters:
 *
 *      vp      pointer to the SNMP agent's information about the
 *              MIB object
 *
 *  Return Values:
 *
 *      pointer to read-only string with varible's ID
 *
 */

MAN_ID_TYPE snmpGetVariableIdentifier(struct variable *vp);




/*
 *
 *  Function: int snmpGetFieldCode(struct variable *vp)
 *
 *  Description:
 *
 *      This function returns an integer that identifies which
 *      columnar object in a row is being accessed.  The value
 *      will correspond to one of the values defined in the
 *      MIB's header file.
 *
 *  Parameters:
 *
 *      vp      pointer to the agent's entry for this MIB
 *              object
 *
 *  Return Values:
 *
 *      integer code that identifies which columnar object
 *      in the row is being read.
 *
 */

int snmpGetFieldCode(struct variable *vp);










/*
 *
 *  Function: snmpIndexType *snmpExtractIndices(struct variable *vp, oid *name, int length, int isRead, int indexStart)
 *
 *  Description:
 *
 *      This routine extracts the indices for a columnar object from the OID
 *      passed by the console and returns them in an snmpIndexType structure
 *      that is dynamically allocated by this function.  
 *
 *      The snmpIndexType structure must be freed by calling snmpFreeIndices().
 *
 *  Parameters:
 *
 *      vp              pointer to SNMP agent's info on the MIB object
 *      name            pointer to OID of the object
 *      nameLength      length of the OID
 *      isRead          set if this is a call to extract read indices
 *      indexStart      start of index in name parameter
 *
 *  Return Values:
 *
 *      NULL        unable to extract indices
 *      !NULL       pointer to an snmpIndexType structure that contains
 *                  the raw SNMP indices provided by the console.
 *
 */

snmpIndexType *snmpExtractIndices(struct variable *vp, oid *name, int nameLength, int isRead, int indexStart);









/*
 *
 *  Function: int snmpEncodeIndices(struct variable *vp, oid *name, snmpIndexType *in)
 *
 *  Description:
 *
 *      This routine encodes table indices onto the end of an OID name.
 *
 *  Parameters:
 *
 *      vp              pointer to SNMP agent's info on the MIB object
 *      name            pointer to OID of the object
 *      in              indices to write
 *
 *  Return Values:
 *
 *      length of OID plus indices
 *
 */

int snmpEncodeIndices(struct variable *vp, oid *name, snmpIndexType *in);





/*
 *
 *  Function: void snmpFreeIndices(snmpIndexType *indices)
 *
 *  Description:
 *
 *      This routine frees the memory allocated by snmpExtractIndices.
 *
 *  Parameters:
 *
 *      indices     pointer to buffer to free
 *
 *  Return Values:
 *
 *      none
 *
 */
void snmpFreeIndices(snmpIndexType *indices);











/*
 *
 *  Function: MAN_ERROR_TYPE snmpReadRow(manVarType *manInfo, manTableIndexType *manIndex, void *row)
 *
 *  Description:
 *
 *      Read a row from a table.  If the row contains octet strings, then they
 *      will be automatically allocated, and must be freed by calling 
 *      snmpFreeOctetStringBuffers().
 *
 *  Parameters:
 *
 *      manInfo             pointer to management API registration info for the table
 *      manIndex            pointer to management API index information
 *      row                 pointer to buffer to receive row read from table
 *
 *  Return Values:
 *
 *      completion code returned by management API
 *
 */
MAN_ERROR_TYPE snmpReadRow(manVarType *manInfo, manTableIndexType *manIndex, void *row);











/*
 *
 *  Function: snmpFreeOctetStringBuffers(manVarType *manInfo, void *row)
 *
 *  Description:
 *
 *      Free any octet string buffers that were allocated by snmpReadRow.
 *      If the table row does not have octet strings, then this function
 *      does nothing.
 *
 *  Parameters:
 *
 *      manInfo     management API information about the table
 *      row         pointer to buffer that may contain octet strings
 *                  allocated by snmpReadRow.
 *
 *  Return Values:
 *
 *      none
 *
 */

void snmpFreeOctetStringBuffers(manVarType *manInfo, void *row);











/*
 *
 *  Function: void *snmpExtractField(struct variable *vp, void *row, int *varLen, void *buffer)
 *
 *  Description:
 *
 *      Extract one field from a table row.  The field is returned in
 *      the format required by the SNMP agent, and *varLen is set to
 *      the field's length.  
 *
 *      If buffer is NULL, then a buffer large enough to hold the field is
 *      allocated using malloc() and a pointer to it is returned.  The caller
 *      must use free() to release this buffer when it is finished with it.
 *      If buffer is not NULL, then is must point to a caller allocated 
 *      buffer large enough to hold the result.  The field is copied into
 *      it and the function returns a pointer to the caller's buffer.
 *
 *  Parameters:
 *
 *      vp              pointer to SNMP agent's information about the columnar object
 *      row             pointer to row read from table
 *      varLen          pointer to int that will be set to the length of the result
 *      buffer          pointer to caller allocated buffer guarenteed to be large enough
 *                      to hold the result, or set to NULL to automatically allocate a
 *                      new buffer with malloc().
 *
 *  Return Values:
 *
 *      !NULL   pointer to buffer that contains the value of the field in the format
 *              that the agent requires.
 *      NULL    unable to allocate buffer, or unable to read the object
 *
 */

void *snmpExtractField(struct variable *vp, void *row, int *varLen, void *buffer);













/*
 *
 *  Function: void *snmpReadObject(struct variable *vp, int *varLen, void *buffer)
 *
 *  Description:
 *
 *      Read the value of a management variable that represents an SNMP object
 *      into a buffer.  If the caller provides a buffer, then use it.  Otherwise,
 *      use malloc() to allocate a buffer for the result.  In this case the caller
 *      must release the buffer with free() when it is finished with it.  The 
 *      result is in the form required by the SNMP agent.
 *
 *  Parameters:
 *
 *      vp              pointer to SNMP agent information about the object
 *      varLen          pointer to int to be set to the result's length
 *      buffer          if not NULL, then must be set to a buffer large enough
 *                      to hold the result.  If it is NULL, then a buffer will
 *                      be allocated using malloc().
 *
 *  Return Values:
 *
 *      !NULL   pointer to buffer with object in the format required by 
 *              the SNMP agent,
 *      NULL    if unable to read the object or allocate memory for it.
 *
 */

void *snmpReadObject(struct variable *vp, int *varLen, void *buffer);








/*
 *
 *  Function: int snmpWriteObject(struct variable *vp, union value *value, int varLen)
 *
 *  Description:
 *
 *      Write the value of a MIB object into a management variable.  If the variable
 *      is a MAN_OCTET_STRING_TYPE, then its buffer will be reallocated if necessary.
 *
 *  Parameters:
 *
 *      vp              pointer to SNMP agent information about the object
 *      value           pointer to value to write
 *      varLen          length of value
 *
 *  Return Values:
 *
 *      SNMP_ERR_NOERROR
 *      SNMP_ERR_NOSUCHNAME             id was not recognized
 *      SNMP_ERR_BADVALUE               value is out of range
 *      SNMP_ERR_RESOURCEUNAVAILABLE    unable to allocated memory
 *      SNMP_ERR_GENERR                 some other error
 *
 */

int snmpWriteObject(struct variable *vp, union value *value, int varLen);








/*
 *
 *  Function: int snmpSetField(int actionCode, struct varBind *info, void *row)
 *
 *  Description:
 *
 *      Copy the value for a field into a row buffer.  If the field
 *      is an octet string, then the octet string buffer must already
 *      be allocated for it.
 *
 *      If actionCode == SNMP_SET_COMMIT, then the value in info->setTo
 *      will be copied to the field.  If actionCode == SNMP_SET_UNDO,
 *      then the value in info->val will be copied.
 *
 *  Parameters:
 *
 *      actionCode  action code from agent
 *      info        pointer to information from agent that includes
 *                  the agent's registry info and the new field value
 *      row         pointer to buffer for table row.  
 *
 *  Return Values:
 *
 *      SNMP_ERR_NOERROR        field has been copied into the buffer
 *      SNMP_ERR_WRONGLENGTH    buffer is too short for the field
 *
 */

int snmpSetField(int actionCode, struct varBind *info, void *row);











/*
 *
 *  Function: int snmpAllocateFieldBuffer(int actionCode, struct varBind *info, void *row)
 *
 *  Description:
 *
 *      Allocate an octet string buffer.  If the current field is an octet
 *      string, then this function will allocate an octet string buffer
 *      large enough to hold the value in info->setTo.  The buffer will
 *      have to be freed by calling snmpFreeOctetStringBuffers().
 *
 *      If the current field is not an octet string, then this function
 *      does nothing.
 *
 *  Parameters:
 *
 *      actionCode  tells us which value we have to allocate for
 *      info        pointer to info provided by the SNMP agent
 *      row         pointer to row buffer that will hold the entire row
 *
 *  Return Values:
 *
 *      SNMP_ERR_NOERROR                row buffer has been updated with 
 *                                      additional buffer (if any)
 *      SNMP_ERR_RESOURCEUNAVAILABLE    unable to allocate buffer
 *
 */

int snmpAllocateFieldBuffer(int actionCode, struct varBind *info, void *row);














/*
 *
 *  Function: int snmpMissingField(WORD32 *fieldBit, int fieldCount)
 *
 *  Description:
 *
 *      This function returns TRUE if one or more bits in the fieldBit
 *      array have not been set.  The number of bits to check for and
 *      the size of the array are determined by fieldCount.  The function
 *      assumes 32 bits per word with the bits inserted LSB first.
 *
 *  Parameters:
 *
 *      fieldBit        pointer to array of WORD32 used as bit flags
 *                      for fields in a table row
 *      fieldCount      number of bits in the bit field
 *
 *  Return Values:
 *
 *      TRUE            some of the bits are zero
 *      FALSE           all of the bits are set
 *
 */

int snmpMissingField(WORD32 *fieldBit, int fieldCount);




/*
 *
 *  Function: MAN_ERROR_TYPE snmpAgentRangeChecker(manVarType *var, void *buffer, int isArray) 
 *
 *  Description:
 *
 *      This function determines whether or not a value about to be written into a variable is
 *      in range.
 *
 *  Parameters:
 *
 *      var             pointer to information about variable
 *      buffer          if write then contains new value for variable
 *      isArray         set if buffer actually points to an array of values to check
 *
 *  Return Values:
 *
 *      MAN_SUCCESS
 *      MAN_UNKNOWN_ID              the id is unknown
 *      MAN_SEMAPHORE_LOCKED        timeout expired before variable could be changed
 *      MAN_COMMUNICATIONS_FAILURE  unable to communicate with device that owns the variable
 *      MAN_NOT_AN_ARRAY            indices was not NULL, but variable is not an array
 *      MAN_ILLEGAL_VALUE           value is illegal for this variable
 *      MAN_INVALID_SUBSCRIPT       one or more array subscripts are out of bounds
 *
 */

MAN_ERROR_TYPE snmpAgentRangeChecker(manVarType *var, void *buffer, int isArray); 










/*
 *
 *  Function: void *manApiAccessor(struct variable *entry, oid *name, int *length, 
 *                          int wantExact, int *outLength, setMethod *writeFn);
 *
 *  Description:
 *
 *      This function is called by the Fusion SNMP agent to access 
 *      a MIB item that is in the management API data base.  We find the
 *      item and return a pointer to a copy of it.  If the variable is
 *      writable, then we return a pointer to its write routine.
 *
 *  Parameters:
 *
 *      entry       pointer to item's entry in the agent's list of variables
 *      name        array of ints with OID of variable
 *      length      number of ints in OID identifier
 *      wantExact   set if caller wants exact match only, clear if get next
 *      outLength   int pointer loaded on return with length of item 
 *                  returned in data buffer
 *      writeFn     pointer loaded on return with address of function that 
 *                  caller can use to write to the variable, or set to NULL
 *                  if the variable is read only.
 *
 *  Return Values:
 *
 *      pointer to data buffer that contains value of MIB item,
 *      or NULL if the instance cannot be found.
 *
 */

void *manApiAccessor(struct variable *entry, oid *name, int *length, 
                          int wantExact, int *outLength, setMethod *writeFn);






/*
 *
 *  Function: int genericWriter (int actionCode, struct varBind *info)
 *                   
 *
 *  Description:
 *
 *      Set the value of an SNMP MIB scalar object variable.
 *
 *      The Fusion agent breaks up the write into four different
 *      phases and calls this function for each phase.  The
 *      current phase is indicated by the value of actionCode.
 *      The possible values are:
 *
 *      SNMP_SET_RESERVE    ignored
 *
 *      SNMP_SET_COMMIT     ignored
 *
 *      SNMP_SET_ACTION     write the value to the variable.
 *
 *      SNMP_SET_FREE       ignored
 *
 *      SNMP_SET_UNDO       restore the object's original value.
 *
 *      info->setTo will contain the new value for the object.
 *      info->val will contain the orignal value of the object.
 *
 *  Parameters:
 *
 *      actionCode  indicates which phase of the write operation
 *                  is being requested.  
 *      info        pointer to structure with information about
 *                  the variable and the value it is being set
 *                  to.  The structure is defined in SNMPIMPL.H.
 *
 *
 *  Return Values:
 *
 *      SNMP_ERR_NOERROR            
 *      SNMP_ERR_TOOBIG             
 *      SNMP_ERR_NOSUCHNAME         
 *      SNMP_ERR_BADVALUE           
 *      SNMP_ERR_READONLY           
 *      SNMP_ERR_GENERR             
 *      SNMP_ERR_NOACCESS           
 *      SNMP_ERR_WRONGTYPE          
 *      SNMP_ERR_WRONGLENGTH        
 *      SNMP_ERR_WRONGENCODING      
 *      SNMP_ERR_WRONGVALUE         
 *      SNMP_ERR_NOCREATION         
 *      SNMP_ERR_INCONSISTENTVALUE  
 *      SNMP_ERR_RESOURCEUNAVAILABLE
 *      SNMP_ERR_COMMITFAILED       
 *      SNMP_ERR_UNDOFAILED         
 *      SNMP_ERR_AUTHORIZATIONERROR 
 *      SNMP_ERR_NOTWRITABLE        
 *      SNMP_ERR_INCONSISTENTNAME   
 *
 */
int genericWriter (int actionCode, struct varBind *info);




/*
 *
 *  Function: int snmpFreeBufferLater(void *buffer)
 *
 *  Description:
 *
 *      This function maintains a list of buffers that are to be freed when 
 *      the SNMP agent finishes processing the current packet.
 *
 *  Parameters:
 *
 *      buffer      pointer to buffer to free
 *
 *  Return Values:
 *
 *      SNMP_ERR_NOERROR
 *      SNMP_ERR_RESOURCEUNAVAILABLE        no more room in buffer list
 *
 */

int snmpFreeBufferLater(void *buffer);





/*
 *
 *  Function: void snmpFreeBuffersNow(void)
 *
 *  Description:
 *
 *      This function frees the buffers that were passed to 
 *      snmpFreeBufferLater() earlier.  This function is
 *      called by the SNMP agent after it sends a reply to
 *      an SNMP console.
 *
 *  Parameters:
 *
 *      none
 *
 *  Return Values:
 *
 *      none
 *
 */

void snmpFreeBuffersNow(void);


#ifdef __cplusplus
}
#endif

#endif


