r5408: - added testing for the behaviour of the special 0x1c name
[Samba/gebeck_regimport.git] / source4 / nbt_server / nbt_server.h
blob6a7b14a5463b1c1b2fe5d31b94373d249837f8db
1 /*
2 Unix SMB/CIFS implementation.
4 NBT server structures
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 "libcli/nbt/libnbt.h"
25 /*
26 a list of our registered names on each interface
28 struct nbtd_iface_name {
29 struct nbtd_iface_name *next, *prev;
30 struct nbtd_interface *iface;
31 struct nbt_name name;
32 uint16_t nb_flags;
33 struct timeval registration_time;
34 uint32_t ttl;
36 /* if registered with a wins server, then this lists the server being
37 used */
38 char *wins_server;
42 /* a list of network interfaces we are listening on */
43 struct nbtd_interface {
44 struct nbtd_interface *next, *prev;
45 struct nbtd_server *nbtsrv;
46 const char *ip_address;
47 const char *bcast_address;
48 const char *netmask;
49 struct nbt_name_socket *nbtsock;
50 struct nbtd_iface_name *names;
55 top level context structure for the nbt server
57 struct nbtd_server {
58 struct task_server *task;
60 /* the list of local network interfaces */
61 struct nbtd_interface *interfaces;
63 /* broadcast interface used for receiving packets only */
64 struct nbtd_interface *bcast_interface;
66 /* wins client interface - used for registering and refreshing
67 our names with a WINS server */
68 struct nbtd_interface *wins_interface;
70 struct wins_server *winssrv;
75 /* check a condition on an incoming packet */
76 #define NBTD_ASSERT_PACKET(packet, src_address, test) do { \
77 if (!(test)) { \
78 nbtd_bad_packet(packet, src_address, #test); \
79 return; \
80 } \
81 } while (0)
83 /* this copes with the nasty hack that is the type 0x1c name */
84 #define IS_GROUP_NAME(name, nb_flags) \
85 ((name)->type != NBT_NAME_LOGON && (nb_flags & NBT_NM_GROUP))