Main Page | Class Hierarchy | Class List | File List | Class Members

Snmp.h

00001 // This is part of tacppd project (extended tacacs++ daemon)
00002 // (c) Copyright in 2000-2004 by tacppd team and contributors
00003 // see http://tacppd.org for more information
00004 //
00005 // file: Snmp.h
00006 // description: header file for SNMP functions
00007 
00008 //  This program is free software; you can redistribute it and/or modify
00009 //  it under the terms of the GNU General Public License as published by
00010 //  the Free Software Foundation; either version 2 of the License, or
00011 //  (at your option) any later version.
00012 //
00013 //  This program is distributed in the hope that it will be useful,
00014 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 //  GNU General Public License for more details.
00017 //
00018 //  You should have received a copy of the GNU General Public License
00019 //  along with this program; if not, write to the Free Software
00020 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021 
00022 // modifications:
00023 //
00024 
00025 /*
00026 This software use NET-SNMP package which have next notice:
00027 
00028 Various copyrights apply to this package, listed in 2 seperate parts
00029 below.  Please make sure that you read both parts.  The first part is
00030 the copyright for all the code up until 2001, and the second part
00031 applies to the derivative work done since then.
00032 
00033 ---- Part 1: CMU/UCD copyright notice: (BSD like) -----
00034 
00035 
00036        Copyright 1989, 1991, 1992 by Carnegie Mellon University
00037 
00038                   Derivative Work - 1996, 1998-2000
00039 Copyright 1996, 1998-2000 The Regents of the University of California
00040 
00041                          All Rights Reserved
00042 
00043 Permission to use, copy, modify and distribute this software and its
00044 documentation for any purpose and without fee is hereby granted,
00045 provided that the above copyright notice appears in all copies and
00046 that both that copyright notice and this permission notice appear in
00047 supporting documentation, and that the name of CMU and The Regents of
00048 the University of California not be used in advertising or publicity
00049 pertaining to distribution of the software without specific written
00050 permission.
00051 
00052 CMU AND THE REGENTS OF THE UNIVERSITY OF CALIFORNIA DISCLAIM ALL
00053 WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
00054 WARRANTIES OF MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL CMU OR
00055 THE REGENTS OF THE UNIVERSITY OF CALIFORNIA BE LIABLE FOR ANY SPECIAL,
00056 INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
00057 FROM THE LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
00058 CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
00059 CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
00060 
00061 
00062 ---- Part 2: NAI copyright notice (BSD) -----
00063 
00064 Copyright (c) 2001, NAI Labs
00065 All rights reserved.
00066 
00067 Redistribution and use in source and binary forms, with or without
00068 modification, are permitted provided that the following conditions are met:
00069 
00070 *  Redistributions of source code must retain the above copyright notice,
00071    this list of conditions and the following disclaimer.
00072 
00073 *  Redistributions in binary form must reproduce the above copyright
00074    notice, this list of conditions and the following disclaimer in the
00075    documentation and/or other materials provided with the distribution.
00076 
00077 *  Neither the name of the NAI Labs nor the names of its contributors
00078    may be used to endorse or promote products derived from this
00079    software without specific prior written permission.
00080 
00081 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
00082 IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
00083 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00084 PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
00085 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00086 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00087 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
00088 OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00089 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00090 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
00091 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00092 */
00093 
00094 // all comments which start from /** - this is comments for KDoc */
00095 //  for classes
00096 //    @short [short description of the class]
00097 //    @author [class author]
00098 //    @version [class version]
00099 //    @see [references to other classes or methods]
00100 //  for methods
00101 //    @see [references]
00102 //    @return [sentence describing the return value]
00103 //    @exception [list the exeptions that could be thrown]
00104 //    @param [name id] [description]    - can be multiple
00105 
00106 #ifndef __SNMP_H__
00107 #define __SNMP_H__
00108 
00109 #include "global.h"
00110 #include "snmp_module.h"
00111 
00112 // this is for working with UCD-SNMP/NET-SNMP functions
00113 extern "C" {
00114 #ifdef USEUCDSNMP
00115   #include <ucd-snmp/ucd-snmp-config.h>
00116   #include <ucd-snmp/ucd-snmp-includes.h>
00117   //extern struct tree *tree_head; // it was need for old UCD-SNMP
00118   //static int quick_print = 0;
00119 #endif /*USEUCDSNMP*/
00120 #ifdef USENETSNMP
00121   #include <net-snmp/net-snmp-config.h>
00122   //#include <net-snmp/utilities.h>
00123   #include <net-snmp/net-snmp-includes.h>
00124 #endif /*USENETSNMP*/
00125 }
00126 
00127 #define SNMP_COMMUN_LEN   30
00128 #define SNMP_TYPE_LEN     20
00129 
00130 //SnmpD *snmp_get(char*,char*,char*);
00131 //bool snmp_puts(char*,char*,char*,char*,char);
00132 
00133 
00134 namespace tacpp {
00135 
00136 class Device_data;
00137 
00138 class Snmp {
00141   pthread_mutex_t Mutex;
00144   void lock();
00147   void unlock();
00148  public:
00151   int count;
00154   Snmp();
00157   ~Snmp();
00160   SnmpDevice *get(Device_data*);
00163   bool drop(char*,char*);
00166   void store_traffic(Device_data*,SnmpDevice*);
00167 };
00168 
00169 };
00170 
00171 #endif //__SNMP_H__

Generated on Thu Jul 21 23:09:45 2005 for tacppd.kdevelop by doxygen 1.3.5