Add a new header file for functions in lib/util/util.c.
[obnox/samba/samba-obnox.git] / libcli / nbt / libnbt.h
index 87183c2c13d5ba69d171e72c0abe9eb02abb0f66..fd0c7fea66d00f089167e722e62159d42d4636d8 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "librpc/gen_ndr/nbt.h"
 #include "librpc/ndr/libndr.h"
+#include "lib/util/xfile.h"
 
 /*
   possible states for pending requests
@@ -95,7 +96,6 @@ struct nbt_name_request {
 struct nbt_name_socket {
        struct socket_context *sock;
        struct tevent_context *event_ctx;
-       struct smb_iconv_convenience *iconv_convenience;
 
        /* a queue of requests pending to be sent */
        struct nbt_name_request *send_queue;
@@ -275,8 +275,10 @@ struct nbt_name_release {
 };
 
 struct nbt_name_socket *nbt_name_socket_init(TALLOC_CTX *mem_ctx,
-                                            struct tevent_context *event_ctx,
-                                            struct smb_iconv_convenience *iconv_convenience);
+                                            struct tevent_context *event_ctx);
+void nbt_name_socket_handle_response_packet(struct nbt_name_request *req,
+                                           struct nbt_name_packet *packet,
+                                           struct socket_address *src);
 struct nbt_name_request *nbt_name_query_send(struct nbt_name_socket *nbtsock,
                                             struct nbt_name_query *io);
 NTSTATUS nbt_name_query_recv(struct nbt_name_request *req,
@@ -291,7 +293,7 @@ NTSTATUS nbt_name_status(struct nbt_name_socket *nbtsock,
                        TALLOC_CTX *mem_ctx, struct nbt_name_status *io);
 
 NTSTATUS nbt_name_dup(TALLOC_CTX *mem_ctx, struct nbt_name *name, struct nbt_name *newname);
-NTSTATUS nbt_name_to_blob(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, DATA_BLOB *blob, struct nbt_name *name);
+NTSTATUS nbt_name_to_blob(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, struct nbt_name *name);
 NTSTATUS nbt_name_from_blob(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, struct nbt_name *name);
 void nbt_choose_called_name(TALLOC_CTX *mem_ctx, struct nbt_name *n, const char *name, int type);
 char *nbt_name_string(TALLOC_CTX *mem_ctx, const struct nbt_name *name);
@@ -327,29 +329,47 @@ NTSTATUS nbt_set_incoming_handler(struct nbt_name_socket *nbtsock,
 NTSTATUS nbt_set_unexpected_handler(struct nbt_name_socket *nbtsock,
                                    void (*handler)(struct nbt_name_socket *, struct nbt_name_packet *,
                                                    struct socket_address *),
-                                   void *private);
+                                   void *private_data);
 NTSTATUS nbt_name_reply_send(struct nbt_name_socket *nbtsock,
                             struct socket_address *dest,
                             struct nbt_name_packet *request);
 
 
-NDR_SCALAR_PROTO(wrepl_nbt_name, const struct nbt_name *)
-NDR_SCALAR_PROTO(nbt_string, const char *)
+NDR_SCALAR_PTR_PROTO(wrepl_nbt_name, struct nbt_name)
 NDR_BUFFER_PROTO(nbt_name, struct nbt_name)
 NTSTATUS nbt_rcode_to_ntstatus(uint8_t rcode);
 
-struct composite_context;
-struct composite_context *nbt_name_register_bcast_send(struct nbt_name_socket *nbtsock,
-                                                      struct nbt_name_register_bcast *io);
-NTSTATUS nbt_name_register_bcast_recv(struct composite_context *c);
-struct composite_context *nbt_name_register_wins_send(struct nbt_name_socket *nbtsock,
-                                                     struct nbt_name_register_wins *io);
-NTSTATUS nbt_name_refresh_wins_recv(struct composite_context *c, TALLOC_CTX *mem_ctx,
-                                    struct nbt_name_refresh_wins *io);
-struct composite_context *nbt_name_refresh_wins_send(struct nbt_name_socket *nbtsock,
-                                                     struct nbt_name_refresh_wins *io);
-NTSTATUS nbt_name_register_wins_recv(struct composite_context *c, TALLOC_CTX *mem_ctx,
+struct tevent_context;
+struct tevent_req;
+struct tevent_req *nbt_name_register_bcast_send(TALLOC_CTX *mem_ctx,
+                                       struct tevent_context *ev,
+                                       struct nbt_name_socket *nbtsock,
+                                       struct nbt_name_register_bcast *io);
+NTSTATUS nbt_name_register_bcast_recv(struct tevent_req *req);
+struct tevent_req *nbt_name_register_wins_send(TALLOC_CTX *mem_ctx,
+                                              struct tevent_context *ev,
+                                              struct nbt_name_socket *nbtsock,
+                                              struct nbt_name_register_wins *io);
+NTSTATUS nbt_name_register_wins_recv(struct tevent_req *req,
+                                    TALLOC_CTX *mem_ctx,
                                     struct nbt_name_register_wins *io);
-
+struct tevent_req *nbt_name_refresh_wins_send(TALLOC_CTX *mem_ctx,
+                                             struct tevent_context *ev,
+                                             struct nbt_name_socket *nbtsock,
+                                             struct nbt_name_refresh_wins *io);
+NTSTATUS nbt_name_refresh_wins_recv(struct tevent_req *req,
+                                   TALLOC_CTX *mem_ctx,
+                                   struct nbt_name_refresh_wins *io);
+
+XFILE *startlmhosts(const char *fname);
+bool getlmhostsent(TALLOC_CTX *ctx, XFILE *fp, char **pp_name, int *name_type,
+               struct sockaddr_storage *pss);
+void endlmhosts(XFILE *fp);
+
+NTSTATUS resolve_lmhosts_file_as_sockaddr(const char *lmhosts_file, 
+                                         const char *name, int name_type,
+                                         TALLOC_CTX *mem_ctx, 
+                                         struct sockaddr_storage **return_iplist,
+                                         int *return_count);
 
 #endif /* __LIBNBT_H__ */