/*
 *            Copyright (c) 1998-2000 by NETsilicon Inc.
 *
 *  This software is copyrighted by and is the sole property of 
 *  NETsilicon.  All rights, title, ownership, or other interests
 *  in the software remain the property of NETsilicon.  This
 *  software may only be used in accordance with the corresponding
 *  license agreement.  Any unauthorized use, duplication, transmission,  
 *  distribution, or disclosure of this software is expressly forbidden.
 *
 *  This Copyright notice may not be removed or modified without prior
 *  written consent of NETsilicon.
 *
 *  NETsilicon, reserves the right to modify this software
 *  without notice.
 *
 *  NETsilicon
 *  411 Waverley Oaks Road                  USA 781.647.1234
 *  Suite 227                               http://www.netsilicon.com
 *  Waltham, MA 02452                       AmericaSales@netsilicon.com
 *
 *************************************************************************
 *
 *     Module Name: snmpapi.h
 *         Version: 1.00
 *   Original Date: 10/07/99	
 *          Author: Charles Gordon
 *   Original Date:  7-Oct-1999
 *          Author: 
 *        Language: Ansi C
 * Compile Options: 
 * Compile defines: 
 *       Libraries: 
 *    Link Options: 
 *
 *    Entry Points: snmp_load(), SNMPSendTrap()
 *
 * Description.
 * =======================================================================
 * This header file contains declarations used in the SNMP library.
 *                                                                        
 *                                                                        
 * Edit Date/Ver   Edit Description
 * ==============  ===================================================
 *	05/23/02 DXL	- Added system group variable as extern to be accessed by dvt
 *
 *      08/05/03 JZW    - added manifest constants
 *                        TRAPADDR_ADD
 *                        TRAPADDR_DELETE
 *                        SNMP_TRAP_ALL - updated autodoc as needed
 */

#ifndef snmpapi_h
#define snmpapi_h

#include <nastatus.h>
#include "trdefs.h"
#include "trasn1.h"
#include "sockapi.h"

#ifdef __cplusplus
extern "C"
{
#endif

/*ad*
 * SNMP traps are alerts generated by agents on a managed device. NET+OS 
 * supports all standard trap types specified in RFC 1157. A trap may 
 * be sent by calling @link naSnmpSendTrap, when running SNMPv1 / SNMPv2c library, 
 * or by calling @link naSnmpSendNotifications, when running SNMPv3 library. 
 * The coldStart(0) generic is automatically sent by the agent at startup. 
 * It can be disabled by calling @link naSnmpDisableColdStartTrap before the 
 * SNMP agent is started. The authenticationFailure(4) trap is automatically sent
 * by the agent, however it can be sent by @link naSnmpSendTrap or @link 
 * naSnmpSendNotifications.
 *
 * @external
 * @category SNMP
 * @since 6.0
 * @name GENERIC_TRAP_TYPES "SNMP Generic Trap Types"
 * @include "snmpapi.h" 
 * @see @link naSnmpSendTrap
 * @see @link naSnmpSendNotifications
 *
 * @param SNMP_TRAP_WARMSTART               SNMP Agent reinitialized its configuration 
 *                                          tables via a warm restart.
 * @param SNMP_TRAP_LINKDOWN                Network interface on the SNMP Agent fails.
 * @param SNMP_TRAP_LINKUP                  Network interface on the SNMP Agent
 *                                          reinitializes.
 * @param SNMP_TRAP_AUTHENTICATIONFAILURE   SNMP Agent gets a request from an unrecognized 
 *                                          community name.
 * @param SNMP_TRAP_EGPNEIGHBORLOSS         SNMP Agent cannot communicate with its EGP 
 *                                          (Exterior Gateway Protocol) peer.
 * @param SNMP_TRAP_ENTERPRISESPECIFIC      Vendor specific error conditions and error codes.
*ad*/
#define SNMP_TRAP_WARMSTART             (0x1)
#define SNMP_TRAP_LINKDOWN              (0x2)
#define SNMP_TRAP_LINKUP                (0x3)
#define SNMP_TRAP_AUTHENTICATIONFAILURE (0x4)
#define SNMP_TRAP_EGPNEIGHBORLOSS       (0x5)
#define SNMP_TRAP_ENTERPRISESPECIFIC    (0x6)

/*ad*
 * Defines the Specific Trap Type field in a SNMPv1 Trap message 
 *
 * This type is used for the specific_trap of the @link naSnmpSendTrap function, 
 * when running SNMPv1 / SNMPv2c library, or by @link naSnmpSendNotifications, 
 * when running SNMPv3 library.
 *
 * @external
 * @category SNMP
 * @since 6.0
 * @name SPECIFIC_TRAP_TYPES "SNMP specific trap types"
 * @include "snmpapi.h"
 *
 * @see @link naSnmpSendTrap
 * @see @link naSnmpSendNotifications
 *
 * @note This field is typically used in conjunction with a SNMP_TRAP_ENTERPRISESPECIFIC
 * type generic_trap.  When all other traps are used, it is recommended to use
 * ESPECIFIC_NOT_DEFINED as the specific trap.
 *
 * @param ESPECIFIC_NOT_DEFINED           (0x0)
 * @param ESPECIFIC_LOAD                  (0x1)
 * @param ESPECIFIC_ERROR                 (0x2)
 * @param ESPECIFIC_NEW                   (0x3)
 * @param ESPECIFIC_DEAD                  (0x4)
 * @param ESPECIFIC_FULL                  (0x5)
 * @param ESPECIFIC_PARTFULL              (0x6)
*ad*/
#define ESPECIFIC_NOT_DEFINED           (0x0)
#define ESPECIFIC_LOAD                  (0x1)
#define ESPECIFIC_ERROR                 (0x2)
#define ESPECIFIC_NEW                   (0x3)
#define ESPECIFIC_DEAD                  (0x4)
#define ESPECIFIC_FULL                  (0x5)
#define ESPECIFIC_PARTFULL              (0x6)


/* Specific Trap for PrinterV1Alert */
#define ESPECIFIC_PRINTER_ALERT     (0x1)
#define ESPECIFIC_JOB_ALERT         (0x2)


/*ad*
 * This defintion is used to determine the community level inside a trap message
 * generated by the @link naSnmpSendTrap function. It is also used for the securityName,
 * in the @link NaSnmpNotificationTarget_t structure, used to initialize the Target MIB 
 * and the Notification MIB by the @link naSnmpSetNotificationTargets function.
 *
 * @external
 * @category SNMP
 * @since 6.0
 * @name COMMUNITY_TYPES "SNMP Community Types"
 * @include "snmpapi.h"
 *
 * @see @link naSnmpSendTrap
 * @see @link naSnmpSetNotificationTargets
 *
 * @param SNMP_COMMUNITY_TYPE_PUBLIC    For the public (read) community
 * @param SNMP_COMMUNITY_TYPE_PRIVATE   For the private (read-write) community
*ad*/
#define SNMP_COMMUNITY_TYPE_PUBLIC      "public"
#define SNMP_COMMUNITY_TYPE_PRIVATE     "private"


/*ad*
 * BER Coded Object types
 *
 * @external
 * @category SNMP
 * @since 6.0
 * @name BER_TYPES "SNMP BER Coded Object types"
 *
 * @param ASN_BOOLEAN       (0x01)
 * @param ASN_INTEGER	    (0x02)
 * @param ASN_BIT_STR	    (0x03)
 * @param ASN_OCTET_STR     (0x04)
 * @param ASN_NULL          (0x05)
 * @param ASN_OBJECT_ID     (0x06)
*ad*/
#define ASN_BOOLEAN                     (0x01)
#define ASN_INTEGER	                    (0x02)
#define ASN_BIT_STR	                    (0x03)
#define ASN_OCTET_STR                   (0x04)
#define ASN_NULL                        (0x05)
#define ASN_OBJECT_ID                   (0x06)

/*ad*
 * Structures used to pass enterprise specific variables.
 *
 * @external
 * @category SNMP
 * @since 6.0
 *
 *
 * @param oid_value		Value of OID in unsigned long format
 * @param value			Value of the variable of specified type and length
 * @param oid_length	Number of digits in OID
 * @param value_type	BER coded type
 * @param value_length	Length of the value in bytes
 *
 * @see @link BER_TYPES 
*ad*/
struct variable_t 
{
    unsigned long oid_value[24];  
    unsigned char value[256];     
    unsigned char oid_length;     
    unsigned char value_type;     
    unsigned char value_length;   
};

/*ad*
 * Maximum length of trap enterprise field of SNMPv1 traps.
 *
 * @external
 * @category SNMP
 * @since 7.0
*ad*/
#define NA_SNMP_ENT_MAX_LEN       64


NaStatus naSnmpStart(void);

NaStatus naSnmpDisableColdStartTrap(void);
NaStatus naSnmpSetPortNumber (unsigned short port);
NaStatus naSnmpGetPortNumber (unsigned short *port);
int snmpd_load(void);
unsigned int naSnmpGetEnterpriseNumber(oid * enterpriseNumberPtr);
void naSnmpSetEnterpriseNumber(oid enterpriseNumber, unsigned int enterpriseLength);
NaStatus naSnmpSetSysObjectID(oid * sysOid, int oidLen);
NaStatus naSnmpGetSysObjectID(oid * sysOid, int * sysOidLen);
unsigned long * SNMPGetSysObjectID(int * size);
NaStatus naSnmpGetSysDescr(char * sysDescr);
char * SNMPGetSysDescr(void);
NaStatus naSnmpSetSysDescr(char * sysDescr);
char * SNMPSetSysContact(char * sys_contact, int size);
NaStatus naSnmpSetSysContact(char * sysContact);
NaStatus naSnmpGetSysContact(char * sysContact);
char * SNMPGetSysContact(void);
NaStatus naSnmpGetSysName(char * sysName);
char * SNMPGetSysName(void);
NaStatus naSnmpSetSysName(char * sysName);
char * SNMPSetSysName(char * sys_name, int size);
NaStatus naSnmpGetSysLocation(char * sysLocation);
char * SNMPGetSysLocation(void);
NaStatus naSnmpSetSysLocation(char * sysLocation);
char * SNMPSetSysLocation(char * sys_location, int size);
char SNMPGetSysServices(void);
NaStatus naSnmpSetSysServices(char sysServices);
       
#ifdef __cplusplus
}
#endif

#endif


