diff --speed-large-files --minimal -Npru gnome-cups-manager-0.31.orig/libgnomecups/snmpkit/ber.h gnome-cups-manager-0.31/libgnomecups/snmpkit/ber.h --- gnome-cups-manager-0.31.orig/libgnomecups/snmpkit/ber.h 2005-03-27 22:44:34.000000000 -0500 +++ gnome-cups-manager-0.31/libgnomecups/snmpkit/ber.h 2005-09-07 11:28:45.000000000 -0400 @@ -35,6 +35,72 @@ #include "snmpkit_tags" #include "snmpkit_except" +// Adapted from definitions in bits/char_traits.h from libstdc++v3. +#if (defined(__GNUC__) && (__GNUC__ >= 3)) +namespace std { + template<> struct char_traits { + typedef unsigned char char_type; + typedef unsigned long int_type; + typedef streampos pos_type; + typedef streamoff off_type; + typedef mbstate_t state_type; + + static void assign(char_type& __c1, const char_type& __c2) { + __c1 = __c2; + } + static bool eq(const char_type& __c1, const char_type& __c2) { + return __c1 == __c2; + } + static bool lt(const char_type& __c1, const char_type& __c2) { + return __c1 < __c2; + } + static int compare(const char_type *__s1, const char_type* __s2, + size_t __n) { + for (size_t __i = 0; __i < __n; ++__i) + if (!eq(__s1[__i], __s2[__i])) + return lt(__s1[__i], __s2[__i]) ? -1 : 1; + return 0; + } + static size_t length(const char_type* __s) { + int __n = 0; + while (*__s) { + __s++; __n++; + } + return __n; + } + static const char_type* + find(const char_type* __s, size_t __n, const char_type& __a) { + return static_cast(memchr(__s, __a, __n)); + } + static char_type* + move(char_type *__s1, const char_type* __s2, size_t __n) { + return static_cast(memmove(__s1, __s2, __n)); + } + static char_type* + copy(char_type* __s1, const char_type* __s2, size_t __n) { + return static_cast(memcpy(__s1, __s2, __n)); + } + static char_type* + assign(char_type* __s, size_t __n, char_type __a) { + return static_cast(memset(__s, __a, __n)); + } + static char_type to_char_type(const int_type& __c) { + return static_cast(__c); + } + static int_type to_int_type(const char_type& __c) { + return static_cast(__c); + } + static bool eq_int_type(const int_type& __c1, const int_type& __c2) { + return __c1 == __c2; + } + static int_type eof() { return static_cast(EOF); } + static int_type not_eof(const int_type& __c) { + return (__c == eof()) ? 0 : __c; + } + }; +} +#endif + typedef std::basic_string ustring; class BerBase { diff --speed-large-files --minimal -Npru gnome-cups-manager-0.31.orig/libgnomecups/snmpkit/README gnome-cups-manager-0.31/libgnomecups/snmpkit/README --- gnome-cups-manager-0.31.orig/libgnomecups/snmpkit/README 2004-08-18 22:35:05.000000000 -0400 +++ gnome-cups-manager-0.31/libgnomecups/snmpkit/README 1969-12-31 19:00:00.000000000 -0500 @@ -1,113 +0,0 @@ - SNMPKIT 0.4 (and up) - -What is it: ------------ - -SNMPkit is a set of routines for polling snmp v1 devices. The intent -of this toolkit is to make certain kinds of queries very simple. The -two things that snmpkit is designed to do very simply is fill -structures, and requests to massive numbers of hosts. There are other -SNMP toolkits available availble but none that I know of deal with -these two issues quite as well. - - Filling structures: - ------------------- -Because there is a packet that has to go somewhere and come back for -every SNMP request, it is a good idea to combine multiple requests -into one packet. Also in many cases SNMP objects are arranged in -tables. An individual row might contain several objects. This maps -really neatly to C structures. So snmpkit allows you to define what -objects you want where in the structure and then does the query and -returns to you a filled structure. In the case where there is a table -with multiple rows, snmpkit will return to you a collection of the -structures filled with the appropriate data. - - Querying massive numbers of hosts: - ---------------------------------- -Most of the snmpkits that I looked at either expect you to do your -queries sequentially or allocate one socket per device. When you are -quering literally hundreds or thousands of hosts, then there are -problems with both of these approaches. In the case of the first one -where you do your queries sequentially the problem is time and hosts -that might be down. If you are quering 3000 devices and 5 percent of -them are down, then the 30 seconds do all the retries to make sure -that it isn't just a slow link or a dropped or misrouted UDP packet -adds up. The problem with the second approach is the load that it puts -on your computer. Since there is a 1-1 mapping between the socket and -the host that you are quering, you can quickly run out of -sockets. SNMPkit solves this problem by multiplexing all the requests -on one socket. - -Installation ------------- - -See the INSTALL file. - -Licencing ---------- - -See the COPYING file. - -Other SNMP resources --------------------- -Brief History of SNMP - http://www.nas.nasa.gov/Groups/LAN/ClassNotes/snmp/ -SNMP FAQ - http://www.landfield.com/faqs/snmp-faq/ -NET-SNMP - Another SNMP library with different goals. - http://net-snmp.sourceforge.net/ - - Reference RFC's - --------------- -SNMP version 1 -rfc1089 - SNMP over Ethernet -rfc1157 - SNMP : Simple Network Management Protocol -rfc1187 - Bulk table retrieval with the SNMP -rfc1212 - Concise MIB definitions. -rfc1213 - MIB-II : Management Information Base for network management of TCP/IP based internets -rfc1215 - Convention for defining traps for use with SNMP -rfc1228 - SNMP-DPI : Simple Network Management Protocol Distributed Program Interface -rfc1270 - SNMP communications services -rfc1303 - A Convention for Describing SNMP-based Agents -rfc1351 - SNMP Administrative Model -rfc1352 - SNMP Security Protocols -rfc1353 - Definitions of Managed Objects for Administration of SNMP Parties - -(note: this library only implements version 1 of SNMP) -SNMP version 2 -rfc1442 - Structure of Management Information for SNMP version 2 -rfc1443 - Textual Conventions for SNMP version 2 -rfc1444 - Conformance Statements for SNMP version 2 -rfc1445 - Administrative Model for SNMP version 2 -rfc1446 - Security Protocols for SNMP version 2 -rfc1447 - Party MIB for SNMP version 2 -rfc1448 - Protocol Operations for SNMP version 2 -rfc1449 - Transport Mappings for SNMP version 2 -rfc1450 - Management Information Base for SNMP version 2 -rfc1503 - Algorithms for Automating Administration in SNMP version 2 Managers -rfc1759 - Common printer mib.I - -SNMP version 3 -rfc2570 - Introduction to Version 3 of the Internet standard Network - Management Framework -rfc2571 - An Architecture for Describing SNMP Management Frameworks -rfc2572 - Message Processing and Dispatching for the Simple Network Management - Protocol (SNMP) -rfc2573 - SNMPv3 Applications -rfc2574 - User-based Security Model (USM) for version 3 of the Simple Network - Management Protocol (SNMPv3) -rfc2575 - View-based Access Control Model (VACM) for the Simple Network - Management Protocol (SNMP) -rfc2576 - Coexistence between SNMP versions - -Acknowlagements ---------------- - -Cisco Systems for giving me the time to write the original npadmin -code. - -VA Linux Systems for giving me the time to abstract snmpkit out of -npadmin. - -Hewlett-Packard for paying for the project that needed snmpkit to be -written. - - diff --speed-large-files --minimal -Npru gnome-cups-manager-0.31.orig/libgnomecups/snmpkit/snmpkit_interface.C gnome-cups-manager-0.31/libgnomecups/snmpkit/snmpkit_interface.C --- gnome-cups-manager-0.31.orig/libgnomecups/snmpkit/snmpkit_interface.C 2005-06-01 10:48:36.000000000 -0400 +++ gnome-cups-manager-0.31/libgnomecups/snmpkit/snmpkit_interface.C 2005-09-07 11:28:45.000000000 -0400 @@ -309,16 +309,26 @@ void *sk_sfiller_get(SNMPSTRUCTFILLER *s sk_errno=SK_DECODE; }catch(BerIntTagException){ sk_errno=SK_DECODE; + }catch(BerIntLengthExecption){ + sk_errno=SK_DECODE; }catch(BerCounterTagException){ sk_errno=SK_DECODE; + }catch(BerCounterLengthExecption){ + sk_errno=SK_DECODE; }catch(BerStringTagException){ sk_errno=SK_DECODE; }catch(BerNullTagException){ sk_errno=SK_DECODE; + }catch(BerNullLengthExecption){ + sk_errno=SK_DECODE; }catch(BerOidTagException){ sk_errno=SK_DECODE; }catch(BerTimeTickTagException){ sk_errno=SK_DECODE; + }catch(BerTimeTickLengthExecption){ + sk_errno=SK_DECODE; + }catch(BerIPAddrLengthExecption){ + sk_errno=SK_DECODE; } return retval; } @@ -356,16 +366,26 @@ void *sk_sfiller_get_next(SNMPSTRUCTFILL sk_errno=SK_DECODE; }catch(BerIntTagException){ sk_errno=SK_DECODE; + }catch(BerIntLengthExecption){ + sk_errno=SK_DECODE; }catch(BerCounterTagException){ sk_errno=SK_DECODE; + }catch(BerCounterLengthExecption){ + sk_errno=SK_DECODE; }catch(BerStringTagException){ sk_errno=SK_DECODE; }catch(BerNullTagException){ sk_errno=SK_DECODE; + }catch(BerNullLengthExecption){ + sk_errno=SK_DECODE; }catch(BerOidTagException){ sk_errno=SK_DECODE; }catch(BerTimeTickTagException){ sk_errno=SK_DECODE; + }catch(BerTimeTickLengthExecption){ + sk_errno=SK_DECODE; + }catch(BerIPAddrLengthExecption){ + sk_errno=SK_DECODE; } return retval; } @@ -486,7 +506,7 @@ int sk_sfiller_remove(SNMPTABLE *st,cons void **sk_table_get(SNMPTABLE *st){ std::list vals; from_c(st)->get(vals); - void **retval=new void *[vals.size()+1]; + void **retval=new void*[vals.size()+1]; retval[vals.size()]=NULL; int i=0; for(std::list::iterator cur=vals.begin();cur!=vals.end();cur++,i++) @@ -494,10 +514,8 @@ void **sk_table_get(SNMPTABLE *st){ return retval; } -int -sk_table_append_int (SNMPTABLE *st,const char *oidstr, - void (*fp)(void*,long)) -{ +int sk_table_append_int(SNMPTABLE *st,const char *oidstr, + void (*fp)(void*,long)){ int retval=0; try{ from_c(st)->append_int(std::string(oidstr),fp); diff --speed-large-files --minimal -Npru gnome-cups-manager-0.31.orig/libgnomecups/snmpkit/snmpsock.C gnome-cups-manager-0.31/libgnomecups/snmpkit/snmpsock.C --- gnome-cups-manager-0.31.orig/libgnomecups/snmpkit/snmpsock.C 2005-03-27 22:53:17.000000000 -0500 +++ gnome-cups-manager-0.31/libgnomecups/snmpkit/snmpsock.C 2001-09-21 16:19:17.000000000 -0400 @@ -63,7 +63,7 @@ public: inline void wakeup(int err){ #ifdef DEBUG - cerr << "wakeup error\n" << flush; + cerr << "wakeup error\n" << flush; #endif errnum=err; diff --speed-large-files --minimal -Npru gnome-cups-manager-0.31.orig/libgnomecups/snmpkit/structfill.C gnome-cups-manager-0.31/libgnomecups/snmpkit/structfill.C --- gnome-cups-manager-0.31.orig/libgnomecups/snmpkit/structfill.C 2005-03-27 22:53:02.000000000 -0500 +++ gnome-cups-manager-0.31/libgnomecups/snmpkit/structfill.C 2005-09-07 11:28:45.000000000 -0400 @@ -28,7 +28,10 @@ #include #include #include -#include + +/* would prefer but some linux systems seem to be + missing it */ +#include #include #include "snmpkit" @@ -91,22 +94,22 @@ int SNMP_structFiller::fillStruct(OidSeq counters or large ints */ if(curber->type()==INT_TAG && cur->type==COUNTER_TAG) // these errors are minor enough and simple enough to fix - cerr << "Warning: Counter returned when Integer expected for " + std::cerr << "Warning: Counter returned when Integer expected for " << cur->oidstr << " Buggy firmware?\n"; else if(curber->type()==COUNTER_TAG && cur->type==INT_TAG) // these errors are minor enough and simple enough to fix - cerr << "Warning: Integer returned when Counter expected for " + std::cerr << "Warning: Integer returned when Counter expected for " << cur->oidstr << " Buggy firmware?\n"; else{ - ios::fmtflags opts=ios::hex; - opts=cerr.flags(opts); - cerr << "Warning: Printer returned a value of type 0x" + std::ios::fmtflags opts=std::ios::hex; + opts=std::cerr.flags(opts); + std::cerr << "Warning: Printer returned a value of type 0x" << static_cast(curber->type()) << " when a value of 0x" << static_cast(cur->type) << " was expected for " << cur->oidstr << " Buggy firmware? Skipping.\n"; - cerr.flags(opts); + std::cerr.flags(opts); retval=0; break; } @@ -177,7 +180,7 @@ void *SNMP_structFiller::get(void *tobef throw SNMPNoResponseException(); if(!fillStruct(retseq,(unsigned char*)tobefilled)){ - cerr << "Warning: printer did not respond with a value for one of the " + std::cerr << "Warning: printer did not respond with a value for one of the " << "OIDs. Buggy firmware?\n"; return NULL; }