/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2000-2001 Boris Popov4* All rights reserved.5*6* Redistribution and use in source and binary forms, with or without7* modification, are permitted provided that the following conditions8* are met:9* 1. Redistributions of source code must retain the above copyright10* notice, this list of conditions and the following disclaimer.11* 2. Redistributions in binary form must reproduce the above copyright12* notice, this list of conditions and the following disclaimer in the13* documentation and/or other materials provided with the distribution.14*15* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND16* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE17* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE18* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE19* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL20* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS21* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)22* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT23* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY24* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF25* SUCH DAMAGE.26*/27#ifndef _NETSMB_NETBIOS_H_28#define _NETSMB_NETBIOS_H_2930/*31* make this file dirty...32*/33#ifndef _NETINET_IN_H_34#include <netinet/in.h>35#endif3637#define NMB_TCP_PORT 1373839#define NBPROTO_TCPSSN 1 /* NETBIOS session over TCP */40#define NBPROTO_IPXSSN 11 /* NETBIOS over IPX */4142#define NB_NAMELEN 1643#define NB_ENCNAMELEN NB_NAMELEN * 244#define NB_MAXLABLEN 634546#define NB_MINSALEN (sizeof(struct sockaddr_nb))4748/*49* name types50*/51#define NBT_WKSTA 0x0052#define NBT_MESSENGER 0x0353#define NBT_RAS_SERVER 0x0654#define NBT_DOMAIN_MASTER_BROWSER 0x1B55#define NBT_DOMAIN_CONTROLLER 0x1C56#define NBT_MASTER_BROWSER 0x1D57#define NBT_NETDDE 0x1F58#define NBT_SERVER 0x2059#define NBT_RAS_CLIENT 0x216061/*62* Session packet types63*/64#define NB_SSN_MESSAGE 0x065#define NB_SSN_REQUEST 0x8166#define NB_SSN_POSRESP 0x8267#define NB_SSN_NEGRESP 0x8368#define NB_SSN_RTGRESP 0x8469#define NB_SSN_KEEPALIVE 0x857071/*72* resolver: Opcodes73*/74#define NBNS_OPCODE_QUERY 0x0075#define NBNS_OPCODE_REGISTER 0x0576#define NBNS_OPCODE_RELEASE 0x0677#define NBNS_OPCODE_WACK 0x0778#define NBNS_OPCODE_REFRESH 0x0879#define NBNS_OPCODE_RESPONSE 0x10 /* or'ed with other opcodes */8081/*82* resolver: NM_FLAGS83*/84#define NBNS_NMFLAG_BCAST 0x0185#define NBNS_NMFLAG_RA 0x08 /* recursion available */86#define NBNS_NMFLAG_RD 0x10 /* recursion desired */87#define NBNS_NMFLAG_TC 0x20 /* truncation occurred */88#define NBNS_NMFLAG_AA 0x40 /* authoritative answer */8990/*91* resolver: Question types92*/93#define NBNS_QUESTION_TYPE_NB 0x002094#define NBNS_QUESTION_TYPE_NBSTAT 0x00219596/*97* resolver: Question class98*/99#define NBNS_QUESTION_CLASS_IN 0x0001100101/*102* resolver: Limits103*/104#define NBNS_MAXREDIRECTS 3 /* maximum number of accepted redirects */105#define NBDG_MAXSIZE 576 /* maximum nbns datagram size */106107/*108* NETBIOS addressing109*/110union nb_tran {111struct sockaddr_in x_in;112/* struct sockaddr_ipx was here. */113};114115struct nb_name {116u_int nn_type;117u_char nn_name[NB_NAMELEN + 1];118u_char * nn_scope;119};120121/*122* Socket address123*/124struct sockaddr_nb {125u_char snb_len;126u_char snb_family;127union nb_tran snb_tran; /* transport */128u_char snb_name[1 + NB_ENCNAMELEN + 1]; /* encoded */129};130131#define snb_addrin snb_tran.x_in132133#endif /* !_NETSMB_NETBIOS_H_ */134135136