2N/A/*
2N/A * Copyright (c) 2000, Boris Popov
2N/A * All rights reserved.
2N/A *
2N/A * Redistribution and use in source and binary forms, with or without
2N/A * modification, are permitted provided that the following conditions
2N/A * are met:
2N/A * 1. Redistributions of source code must retain the above copyright
2N/A * notice, this list of conditions and the following disclaimer.
2N/A * 2. Redistributions in binary form must reproduce the above copyright
2N/A * notice, this list of conditions and the following disclaimer in the
2N/A * documentation and/or other materials provided with the distribution.
2N/A * 3. All advertising materials mentioning features or use of this software
2N/A * must display the following acknowledgement:
2N/A * This product includes software developed by Boris Popov.
2N/A * 4. Neither the name of the author nor the names of any co-contributors
2N/A * may be used to endorse or promote products derived from this software
2N/A * without specific prior written permission.
2N/A *
2N/A * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
2N/A * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2N/A * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2N/A * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2N/A * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2N/A * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2N/A * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2N/A * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2N/A * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2N/A * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2N/A * SUCH DAMAGE.
2N/A *
2N/A * $Id: nb_lib.h,v 1.4 2004/12/11 05:23:58 lindak Exp $
2N/A */
2N/A
2N/A/*
2N/A * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A#ifndef _NETSMB_NB_LIB_H_
2N/A#define _NETSMB_NB_LIB_H_
2N/A
2N/A/*
2N/A * Error codes
2N/A */
2N/A#define NBERR_INVALIDFORMAT 0x0001
2N/A#define NBERR_SRVFAILURE 0x0002
2N/A#define NBERR_NAMENOTFOUND 0x0003
2N/A#define NBERR_IMP 0x0004
2N/A#define NBERR_REFUSED 0x0005
2N/A#define NBERR_ACTIVE 0x0006
2N/A#define NBERR_HOSTNOTFOUND 0x0101
2N/A#define NBERR_TOOMANYREDIRECTS 0x0102
2N/A#define NBERR_INVALIDRESPONSE 0x0103
2N/A#define NBERR_NAMETOOLONG 0x0104
2N/A#define NBERR_NOBCASTIFS 0x0105
2N/A#define NBERR_MAX 0x0106
2N/A#define NBERROR(e) ((e) | SMB_NB_ERROR)
2N/A
2N/A#define NBCF_RESOLVED 0x0001
2N/A#define NBCF_NS_ENABLE 0x0002 /* any NetBIOS lookup */
2N/A#define NBCF_BC_ENABLE 0x0004 /* lookup via broadcast */
2N/A
2N/A/*
2N/A * nb environment
2N/A */
2N/Astruct nb_ctx {
2N/A int nb_flags;
2N/A int nb_timo;
2N/A char *nb_scope; /* NetBIOS scope */
2N/A in_addr_t nb_wins1; /* primary WINS */
2N/A in_addr_t nb_wins2; /* secondary WINS (unused now) */
2N/A struct sockaddr_in nb_lastns; /* see cmd:lookup.c */
2N/A};
2N/Atypedef struct nb_ctx nb_ctx_t;
2N/A
2N/A/*
2N/A * resource record
2N/A */
2N/Astruct nbns_rr {
2N/A uchar_t *rr_name; /* compressed NETBIOS name */
2N/A uint16_t rr_type;
2N/A uint16_t rr_class;
2N/A uint32_t rr_ttl;
2N/A uint16_t rr_rdlength;
2N/A uchar_t *rr_data;
2N/A};
2N/Atypedef struct nbns_rr nfns_rr_t;
2N/A
2N/A/*
2N/A * NetBIOS name return
2N/A */
2N/Astruct nbns_nr {
2N/A char ns_name[NB_NAMELEN];
2N/A uint16_t ns_flags;
2N/A};
2N/Atypedef struct nbns_nr nbns_nr_t;
2N/A
2N/A#define NBRQF_POINT 0x0000
2N/A#define NBRQF_BROADCAST 0x0001
2N/A
2N/A#define NBNS_GROUPFLG 0x8000
2N/A
2N/Astruct sockaddr;
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/Astruct rcfile;
2N/Aint smbfs_nbns_resolvename(const char *, struct nb_ctx *, struct sockaddr **);
2N/Aint smbfs_nbns_getnodestatus(struct nb_ctx *ctx, struct in_addr *,
2N/A char *system, char *workgroup);
2N/Aint smbfs_nbns_getaddrinfo(const char *, struct nb_ctx *, struct addrinfo **);
2N/Aconst char *smbfs_nb_strerror(int error);
2N/A
2N/Aint smbfs_nb_ctx_create(struct nb_ctx **);
2N/Avoid smbfs_nb_ctx_done(struct nb_ctx *);
2N/Aint smbfs_nb_ctx_setns(struct nb_ctx *, const char *);
2N/Aint smbfs_nb_ctx_setscope(struct nb_ctx *, const char *);
2N/Aint smbfs_nb_ctx_resolve(struct nb_ctx *);
2N/Aint smbfs_nb_ctx_setwins(struct nb_ctx *, const char *, const char *);
2N/Aint smbfs_nb_ctx_getconfigs(struct nb_ctx *);
2N/Avoid smbfs_nb_ctx_setnbflags(struct nb_ctx *, int, int);
2N/A
2N/Aint smbfs_nb_resolvehost_in(const char *, struct in_addr *);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* !_NETSMB_NB_LIB_H_ */