~zulcss/samba/server-dailies-3.4

« back to all changes in this revision

Viewing changes to source4/nbt_server/nbt_server.h

  • Committer: Chuck Short
  • Date: 2010-09-28 20:38:39 UTC
  • Revision ID: zulcss@ubuntu.com-20100928203839-pgjulytsi9ue63x1
Initial version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
2
   Unix SMB/CIFS implementation.
 
3
 
 
4
   NBT server structures
 
5
 
 
6
   Copyright (C) Andrew Tridgell        2005
 
7
   
 
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 3 of the License, or
 
11
   (at your option) any later version.
 
12
   
 
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.
 
17
   
 
18
   You should have received a copy of the GNU General Public License
 
19
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
20
*/
 
21
 
 
22
#include "../libcli/nbt/libnbt.h"
 
23
#include "libcli/wrepl/winsrepl.h"
 
24
#include "libcli/dgram/libdgram.h"
 
25
#include "librpc/gen_ndr/irpc.h"
 
26
#include "lib/messaging/irpc.h"
 
27
 
 
28
/* 
 
29
   a list of our registered names on each interface
 
30
*/
 
31
struct nbtd_iface_name {
 
32
        struct nbtd_iface_name *next, *prev;
 
33
        struct nbtd_interface *iface;
 
34
        struct nbt_name name;
 
35
        uint16_t nb_flags;
 
36
        struct timeval registration_time;
 
37
        uint32_t ttl;
 
38
 
 
39
        /* if registered with a wins server, then this lists the server being
 
40
           used */
 
41
        const char *wins_server;
 
42
};
 
43
 
 
44
struct nbtd_wins_wack_state;
 
45
 
 
46
/* a list of network interfaces we are listening on */
 
47
struct nbtd_interface {
 
48
        struct nbtd_interface *next, *prev;
 
49
        struct nbtd_server *nbtsrv;
 
50
        const char *ip_address;
 
51
        const char *bcast_address;
 
52
        const char *netmask;
 
53
        struct nbt_name_socket *nbtsock;
 
54
        struct nbt_dgram_socket *dgmsock;
 
55
        struct nbtd_iface_name *names;
 
56
        struct nbtd_wins_wack_state *wack_queue;
 
57
};
 
58
 
 
59
 
 
60
/*
 
61
  top level context structure for the nbt server
 
62
*/
 
63
struct nbtd_server {
 
64
        struct task_server *task;
 
65
 
 
66
        /* the list of local network interfaces */
 
67
        struct nbtd_interface *interfaces;
 
68
 
 
69
        /* broadcast interface used for receiving packets only */
 
70
        struct nbtd_interface *bcast_interface;
 
71
 
 
72
        /* wins client interface - used for registering and refreshing
 
73
           our names with a WINS server */
 
74
        struct nbtd_interface *wins_interface;
 
75
 
 
76
        struct wins_server *winssrv;
 
77
 
 
78
        struct nbtd_statistics stats;
 
79
 
 
80
        struct ldb_context *sam_ctx;
 
81
};
 
82
 
 
83
 
 
84
 
 
85
/* check a condition on an incoming packet */
 
86
#define NBTD_ASSERT_PACKET(packet, src, test) do { \
 
87
        if (!(test)) { \
 
88
                nbtd_bad_packet(packet, src, #test); \
 
89
                return; \
 
90
        } \
 
91
} while (0)
 
92
 
 
93
struct interface;
 
94
#include "nbt_server/nbt_server_proto.h"