/*
*    check_snmp_interface_status . A Nagios plugin to monitor interface status via SNMP
*
*    This program is free software; you can redistribute it and/or modify
*    it under the terms of the GNU General Public License as published by
*    the Free Software Foundation; either version 2 of the License, or
*    (at your option) any later version.
*
*    This program is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU General Public License for more details.
*
*    You should have received a copy of the GNU General Public License
*    along with this program; see the file COPYING. If not, write to the
*    Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include <sys/types.h>
#include <stdbool.h>

#define OK 0
#define WARNING 1
#define CRITICAL 2
#define UNKNOWN 3
#define up 1
#define down 2
#define testing 3

struct interfacestruct
{
  char name[256];
  char *interfacenumber;
  int interfacestatus;
  int admininterfacestatus;
};

struct interfacestruct intstruct;

int securityLevel = 1;
int authProtocol = -1;
int privProtocol = -1;
int timeout = 0;
int adminStatus = CRITICAL;

char *securityName = NULL;
char *ifDescrName = NULL;
char *port = "161";

bool Warn = false;
bool Perfdata = false;
bool ifdescr = false;
bool ifname = false;
bool ifnumber = false;
bool ifalias = false;


char *our_v3_passphrase = NULL;
char *our_v3_priv_passphrase = NULL;
char *snmpIfOperStatus = ".1.3.6.1.2.1.2.2.1.8.";
char *snmpIfDescr = ".1.3.6.1.2.1.2.2.1.2.";
char *snmpIfAdminStatus = ".1.3.6.1.2.1.2.2.1.7.";
char *snmpIfName = ".1.3.6.1.2.1.31.1.1.1.1.";
char *snmpIfAlias = ".1.3.6.1.2.1.31.1.1.1.18.";
char *snmpLocIfDescr = ".1.3.6.1.4.1.9.2.2.1.1.28.";
char *snmpIfType = ".1.3.6.1.2.1.2.2.1.3.";

char *oids[]={ ".1.3.6.1.2.1.2.2.1.8.", // iFOperStatus
               ".1.3.6.1.2.1.2.2.1.2.", // IfName
               ".1.3.6.1.2.1.2.2.1.7.", // IfAdminStatus
               NULL };



int checkInterface( char *host, char *community, char *interface, int version, char *interfacename );
int check_and_print( );
int is_integer(char *number);
void print_version(void);
void usage(void);
char *get_index( char *host, char *community, char *interface, int version );
