* snmp.c from Access Point SNMP Utils for Linux
* basic snmp packets assembly/disassembly and send/receive functions
*
- * Copyright (c) 2002 Roman Festchook <roma at polesye dot net>
+ * Copyright (c) Roman Festchook <roma at polesye dot net>
+ * Jan Rafaj <jr-aputils at cedric dot unob dot cz>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License Version 2 from
#include <arpa/inet.h>
#include "ap-utils.h"
-#define RETRIES 5
-
sigjmp_buf position;
extern char *community;
extern short ap_type;
extern int sockfd;
extern struct in_addr ap_ip;
-int retries;
+
+int snmp_retries = 5, retries;
char *buf = NULL;
static void alarm_handler()
siglongjmp(position, 1);
}
+/*
+unsigned int ber_decode_uint(unsigned char *bevp, int len)
+{
+ unsigned int out = 0;
+
+ while (len--) {
+ out = (out << 7) | (*bevp & (*bevp & 0x80 ? 0x7f : 0xff));
+ bevp++;
+ }
+
+ return out;
+}
+*/
+
int ber(char *message, varbind * varbindlist, int num, int type)
{
server.sin_addr.s_addr = ap_ip.s_addr;
signal(SIGALRM, alarm_handler);
- retries = RETRIES;
+ retries = snmp_retries;
sigsetjmp(position, 1);
if (!retries) {
return 0;