/*****************************************************************************
* Copyright (c) 2006 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
*
*****************************************************************************/
#ifndef snmpv1v2capi_h
#define snmpv1v2capi_h

#ifdef __cplusplus
extern "C"
{
#endif

#include "Npttypes.h"
#include "nastatus.h"
#include "snmpimpl.h"
#include "sockapi.h"

/*ad*
 * Maximum community string length
 *
 * @external
 * @category SNMP:v1_v2c
 * @since 7.0
 *
 * @see @link NaSnmpTrap_t
*ad*/
#define NA_SNMP_COMMUNITY_MAX_LEN 64

/*ad*
 * Disables SNMPv1 trap
 *
 * @external
 * @category SNMP:v1_v2c
 * @since 7.1
 *
 * @see @link NaSnmpTrap_t
 * @see @link naSnmpAddTrap
 * @see @link naSnmpSendTrap
*ad*/
#define NA_SNMP_TRAP_NO_V1   0x02 

/*ad*
 * Disables SNMPv2c trap
 *
 * @external
 * @category SNMP:v1_v2c
 * @since 7.1
 *
 * @see @link NaSnmpTrap_t
 * @see @link naSnmpAddTrap
 * @see @link naSnmpSendTrap
*ad*/
#define NA_SNMP_TRAP_NO_V2C  0x04 /* set means dont send the v2c one */


/*ad*
 * Trap data type
 *
 * @param   destAddr        Trap manager's IP address.        
 * @param   srcAddr         Agent IP address.
 * @param   enterpriseNum   Enterprise number assigned to the organization by IETF.
 * @param   enterpriseLen   Length of enterprise OID, <= @link NA_SNMP_ENT_MAX_LEN.
 * @param   enterprise      Trap enterprise field of SNMPv1 trap. It can be of any length between 8
 *                          and 64. The sub-oids 0 to 6 are pre-defined as 1.3.6.1.4.1.enterpriseNum.      
 * @param   communityLen    Community string length, <= @link NA_SNMP_COMMUNITY_MAX_LEN.
 * @param   community       The community string sent with SNMPv1 and SNMPv2 traps; see @link COMMUNITY_TYPES.
 * @param   versionFilter   A bit mask of SNMP trap versions not to send. 
 *                          <list type = "unordered">
 *                              <item>@link NA_SNMP_TRAP_NO_V1  -- do not send SNMPv1 trap</item>
 *                              <item>@link NA_SNMP_TRAP_NO_V2C -- do not send SNMPv2c trap</item>
 *                              <item>0                   -- send both SNMPv1 and SNMPv2c traps</item>
 *                          </list>
 * 
 * @external
 * @category SNMP:v1_v2c
 * @since 7.1
 *
 * @see @link naSnmpAddTrap
 * @see @link naSnmpDeleteTrap
 * @see @link naSnmpGetTrap
 * @see @link naSnmpSendTrap
*ad*/
typedef struct
{
    struct sockaddr_storage destAddr;
    struct sockaddr_storage srcAddr;
    oid     enterpriseNum;
    u_long  enterpriseLen;
    oid     enterprise[NA_SNMP_ENT_MAX_LEN];
    int     communityLen;
    u_char  community[NA_SNMP_COMMUNITY_MAX_LEN];
    u_short versionFilter;

} NaSnmpTrap_t;


NaStatus naSnmpSendTrap(int generic_trap, 
                        int specific_trap, 
                        int interface_index,
                        int num_variables,
                        struct variable_t const * variables,
                        NaSnmpTrap_t * trap);

NaStatus naSnmpAddTrap(NaSnmpTrap_t * const trap);
NaStatus naSnmpDeleteTrap(NaSnmpTrap_t const * trap);
NaStatus naSnmpGetTrap(NaSnmpTrap_t * trap, int trapIndex);

#ifdef __cplusplus
}
#endif

#endif

