1 #if !defined STATUSQ_H
2 #define STATUSQ_H
3 
4 #if defined HAVE_STDINT_H
5 #include <stdint.h>
6 #endif
7 #include <sys/types.h>
8 
9 #define FL_REQUEST		0x8000
10 #define FL_QUERY		0x7800
11 #define FL_NON_AUTH_ANSWER	0x0400
12 #define FL_DGRAM_NOT_TRUNCATED	0x0200
13 #define FL_RECURSION_NOT_DESIRED	0x0100
14 #define FL_RECURSION_NOT_AVAIl	0x0080
15 #define FL_RESERVED1		0x0040
16 #define FL_RESERVED2		0x0020
17 #define	FL_BROADCAST		0x0010
18 #define FL_SUCCESS		0x000F
19 
20 #define	QT_NODE_STATUS_REQUEST	0x0021
21 #define QC_INTERNET		0x0001
22 
23 #define NB_DGRAM		137
24 
25 struct nbname {
26     char ascii_name [16] ;
27     my_uint16_t rr_flags;
28 };
29 
30 struct nbname_request {
31     my_uint16_t transaction_id;
32     my_uint16_t flags;
33     my_uint16_t question_count;
34     my_uint16_t answer_count;
35     my_uint16_t name_service_count;
36     my_uint16_t additional_record_count;
37     char question_name[34];
38     my_uint16_t question_type;
39     my_uint16_t question_class;
40 };
41 
42 #define NBNAME_REQUEST_SIZE 50
43 #define UDP_HEADER_SIZE 8
44 #define IP_HEADER_SIZE 20
45 
46 typedef struct nbname_response_header {
47     my_uint16_t transaction_id;
48     my_uint16_t flags;
49     my_uint16_t question_count;
50     my_uint16_t answer_count;
51     my_uint16_t name_service_count;
52     my_uint16_t additional_record_count;
53     char question_name[34];
54     my_uint16_t question_type;
55     my_uint16_t question_class;
56     my_uint32_t ttl;
57     my_uint16_t rdata_length;
58     my_uint8_t number_of_names;
59 } nbname_response_header_t;
60 
61 /* #define NBNAME_RESPONSE_NUMBER_OF_NAMES_OFFSET 56 */
62 
63 #define NBNAME_RESPONSE_HEADER_SIZE 57
64 
65 typedef struct nbname_response_footer {
66     my_uint8_t adapter_address [6];
67     my_uint8_t version_major;
68     my_uint8_t version_minor;
69     my_uint16_t duration;
70     my_uint16_t frmps_received;
71     my_uint16_t frmps_transmitted;
72     my_uint16_t iframe_receive_errors;
73     my_uint16_t transmit_aborts;
74     my_uint32_t transmitted;
75     my_uint32_t received;
76     my_uint16_t iframe_transmit_errors;
77     my_uint16_t no_receive_buffer;
78     my_uint16_t tl_timeouts;
79     my_uint16_t ti_timeouts;
80     my_uint16_t free_ncbs;
81     my_uint16_t ncbs;
82     my_uint16_t max_ncbs;
83     my_uint16_t no_transmit_buffers;
84     my_uint16_t max_datagram;
85     my_uint16_t pending_sessions;
86     my_uint16_t max_sessions;
87     my_uint16_t packet_sessions;
88 } nbname_response_footer_t ;
89 
90 #define NBNAME_RESPONSE_FOOTER_SIZE 50
91 
92 struct nb_host_info {
93     struct nbname_response_header* header;
94     struct nbname* names;
95     struct nbname_response_footer* footer;
96     int is_broken;
97 };
98 
99 typedef struct nb_service {
100     char nb_name[16];
101     my_uint8_t service_number;
102     int unique;
103     char* service_name;
104 } nb_service_t ;
105 
106 #endif /* STATUSQ_H */
107