File: queries.h

package info (click to toggle)
braa 0.82-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 400 kB
  • sloc: ansic: 3,097; perl: 155; makefile: 12; sh: 10
file content (70 lines) | stat: -rw-r--r-- 1,352 bytes parent folder | download | duplicates (5)
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;
	
	u_int32_t start;
	u_int32_t end;
	u_int16_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;
	
	u_int32_t host;

	char get_retries;
	char set_retries;

	oid ** latest_oid;
	char * walk_retries; 
	struct timeb * 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 retries, int xdelay, int sdelay, int pass_delay);
#define MAX_RECV_PACKET 1600
#define RETRIES_MAX 126
#define DEFAULT_XDELAY 20000