snmpclient.c (146525) | snmpclient.c (150920) |
---|---|
1/* 2 * Copyright (c) 2004-2005 3 * Hartmut Brandt. 4 * All rights reserved. 5 * Copyright (c) 2001-2003 6 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). 7 * All rights reserved. 8 * --- 16 unchanged lines hidden (view full) --- 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * | 1/* 2 * Copyright (c) 2004-2005 3 * Hartmut Brandt. 4 * All rights reserved. 5 * Copyright (c) 2001-2003 6 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). 7 * All rights reserved. 8 * --- 16 unchanged lines hidden (view full) --- 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * |
33 * $Begemot: bsnmp/lib/snmpclient.c,v 1.31 2005/05/23 11:10:13 brandt_h Exp $ | 33 * $Begemot: bsnmp/lib/snmpclient.c,v 1.34 2005/10/04 14:32:42 brandt_h Exp $ |
34 * 35 * Support functions for SNMP clients. 36 */ 37#include <sys/types.h> 38#include <sys/time.h> 39#include <sys/queue.h> 40#include <sys/socket.h> 41#include <sys/un.h> 42#include <stdio.h> 43#include <stdlib.h> 44#include <stddef.h> 45#include <stdarg.h> 46#include <string.h> 47#include <errno.h> 48#include <unistd.h> 49#include <fcntl.h> 50#include <netdb.h> | 34 * 35 * Support functions for SNMP clients. 36 */ 37#include <sys/types.h> 38#include <sys/time.h> 39#include <sys/queue.h> 40#include <sys/socket.h> 41#include <sys/un.h> 42#include <stdio.h> 43#include <stdlib.h> 44#include <stddef.h> 45#include <stdarg.h> 46#include <string.h> 47#include <errno.h> 48#include <unistd.h> 49#include <fcntl.h> 50#include <netdb.h> |
51#ifdef HAVE_STDINT_H |
|
51#include <stdint.h> | 52#include <stdint.h> |
53#elif defined(HAVE_INTTYPES_H) 54#include <inttypes.h> 55#endif |
|
52#include <limits.h> 53#ifdef HAVE_ERR_H 54#include <err.h> 55#endif 56 57#include "support.h" 58#include "asn1.h" 59#include "snmp.h" --- 484 unchanged lines hidden (view full) --- 544 e->found, work->descr->req_mask); 545 return (-1); 546 } 547 return (0); 548} 549 550/* 551 * Fetch a table. Returns 0 if ok, -1 on errors. | 56#include <limits.h> 57#ifdef HAVE_ERR_H 58#include <err.h> 59#endif 60 61#include "support.h" 62#include "asn1.h" 63#include "snmp.h" --- 484 unchanged lines hidden (view full) --- 548 e->found, work->descr->req_mask); 549 return (-1); 550 } 551 return (0); 552} 553 554/* 555 * Fetch a table. Returns 0 if ok, -1 on errors. |
552 * This is the synchronuous variant. | 556 * This is the synchronous variant. |
553 */ 554int 555snmp_table_fetch(const struct snmp_table *descr, void *list) 556{ 557 struct snmp_pdu resp; 558 struct tabwork work; 559 int ret; 560 --- 995 unchanged lines hidden (view full) --- 1556 warnx("SNMP GET: bad syntax in response"); 1557 return (-1); 1558 } 1559 } 1560 return (1); 1561} 1562 1563/* | 557 */ 558int 559snmp_table_fetch(const struct snmp_table *descr, void *list) 560{ 561 struct snmp_pdu resp; 562 struct tabwork work; 563 int ret; 564 --- 995 unchanged lines hidden (view full) --- 1560 warnx("SNMP GET: bad syntax in response"); 1561 return (-1); 1562 } 1563 } 1564 return (1); 1565} 1566 1567/* |
1564 * Check the reponse to a SET PDU. We check: - the error status must be 0 - | 1568 * Check the response to a SET PDU. We check: - the error status must be 0 - |
1565 * the number of bindings must be equal in response and request - the 1566 * syntaxes must be the same in response and request - the OIDs must be the 1567 * same in response and request 1568 */ 1569static int 1570ok_set(const struct snmp_pdu * req, const struct snmp_pdu * resp) 1571{ 1572 u_int i; --- 248 unchanged lines hidden --- | 1569 * the number of bindings must be equal in response and request - the 1570 * syntaxes must be the same in response and request - the OIDs must be the 1571 * same in response and request 1572 */ 1573static int 1574ok_set(const struct snmp_pdu * req, const struct snmp_pdu * resp) 1575{ 1576 u_int i; --- 248 unchanged lines hidden --- |