-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathqueries.h
70 lines (49 loc) · 1.33 KB
/
queries.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
struct query_hostrange
{
struct query_hostrange * next;
uint32_t start;
uint32_t end;
uint16_t port;
int query_count;
char ** queries;
char * community;
char ** get_ids;
char ** set_ids;
char ** walk_ids;
char get_count;
char set_count;
char walk_count;
oid ** first_oid;
asnobject * get_message;
asnobject * set_message;
};
int bapp_rangesplit_query(struct query_hostrange ** head, char * string, char * errbuff, int len);
struct query
{
struct query * hashnext;
struct query * listnext;
uint32_t host;
char get_retries;
char set_retries;
oid ** latest_oid;
char * walk_retries;
struct timespec * walk_contact;
struct query_hostrange * range;
}; /* 26 + 2 bytes */
struct queryhash
{
int version, responses_needed, responses_received;
struct query * last_sent;
struct query * list;
#define QUERY_HASH_SIZE 256
struct query * hash[QUERY_HASH_SIZE];
};
/* request ID:
7 bits (optional) WALK ID + 16 bits TIMESTAMP + 8 bits PDU TYPE
*/
struct queryhash * bapp_make_hash(int version, struct query_hostrange *head, char * errbuf, int len);
int bapp_processmessages(int s, struct queryhash *qh, int hexdump);
int bapp_sendmessage(struct queryhash *qh, int s, int bulks, int retries, int xdelay, int sdelay, int pass_delay);
#define MAX_RECV_PACKET 1600
#define RETRIES_MAX 126
#define DEFAULT_XDELAY 20000