2 Unix SMB/CIFS implementation.
4 a raw async NBT library
6 Copyright (C) Andrew Tridgell 2005
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include "librpc/gen_ndr/ndr_nbt.h"
26 possible states for pending requests
28 enum nbt_request_state {NBT_REQUEST_SEND,
37 struct nbt_name_request {
38 struct nbt_name_request *next, *prev;
40 enum nbt_request_state state;
44 /* the socket this was on */
45 struct nbt_name_socket *nbtsock;
47 /* where to send the request */
48 const char *dest_addr;
51 /* the timeout event */
52 struct timed_event *te;
54 struct nbt_name_packet *request;
56 /* shall we allow multiple replies? */
57 BOOL allow_multiple_replies;
60 struct nbt_name_reply {
61 struct nbt_name_packet *packet;
62 const char *reply_addr;
66 /* information on what to do on completion */
68 void (*fn)(struct nbt_name_request *);
76 context structure for operations on name queries
78 struct nbt_name_socket {
79 struct socket_context *sock;
80 struct event_context *event_ctx;
82 /* a queue of requests pending to be sent */
83 struct nbt_name_request *send_queue;
88 /* mapping from name_trn_id to pending event */
89 struct idr_context *idr;
91 /* how many requests are waiting for a reply */
94 /* what to do with incoming request packets */
96 void (*handler)(struct nbt_name_socket *, struct nbt_name_packet *,
104 /* a simple name query */
105 struct nbt_name_query {
107 struct nbt_name name;
108 const char *dest_addr;
111 int timeout; /* in seconds */
114 const char *reply_from;
115 struct nbt_name name;
116 const char *reply_addr;
120 /* a simple name status query */
121 struct nbt_name_status {
123 struct nbt_name name;
124 const char *dest_addr;
125 int timeout; /* in seconds */
128 const char *reply_from;
129 struct nbt_name name;
130 struct nbt_rdata_status status;