summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-02-04 01:39:10 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:09:31 -0500
commitbd22848ad80dbe10551129325a59114d9a612f91 (patch)
treee3b9c1fe309a112bedef10a3c222e585fccdcce8 /source4
parent60d9b40ba4fec876b7288bd51340d6b302af00e3 (diff)
downloadsamba-bd22848ad80dbe10551129325a59114d9a612f91.tar.gz
samba-bd22848ad80dbe10551129325a59114d9a612f91.tar.bz2
samba-bd22848ad80dbe10551129325a59114d9a612f91.zip
r5210: changed server side nbt functions to be prefixed with nbtd_ instead of
nbt_, so as to more clearly separate them from the client code in libcli/nbt/ (This used to be commit b07a7e35f26204055a99abf72438b5cd7ec35d3b)
Diffstat (limited to 'source4')
-rw-r--r--source4/nbt_server/interfaces.c41
-rw-r--r--source4/nbt_server/nbt_server.c4
-rw-r--r--source4/nbt_server/nbt_server.h2
-rw-r--r--source4/nbt_server/nodestatus.c21
-rw-r--r--source4/nbt_server/packet.c4
-rw-r--r--source4/nbt_server/query.c28
-rw-r--r--source4/nbt_server/register.c49
-rw-r--r--source4/nbt_server/winsserver.c6
8 files changed, 79 insertions, 76 deletions
diff --git a/source4/nbt_server/interfaces.c b/source4/nbt_server/interfaces.c
index 312d188d49..a9041706c6 100644
--- a/source4/nbt_server/interfaces.c
+++ b/source4/nbt_server/interfaces.c
@@ -29,13 +29,13 @@
/*
receive an incoming request and dispatch it to the right place
*/
-static void nbt_request_handler(struct nbt_name_socket *nbtsock,
- struct nbt_name_packet *packet,
- const char *src_address, int src_port)
+static void nbtd_request_handler(struct nbt_name_socket *nbtsock,
+ struct nbt_name_packet *packet,
+ const char *src_address, int src_port)
{
switch (packet->operation & NBT_OPCODE) {
case NBT_OPCODE_QUERY:
- nbt_request_query(nbtsock, packet, src_address, src_port);
+ nbtd_request_query(nbtsock, packet, src_address, src_port);
break;
}
}
@@ -45,8 +45,9 @@ static void nbt_request_handler(struct nbt_name_socket *nbtsock,
/*
find a registered name on an interface
*/
-struct nbt_iface_name *nbt_find_iname(struct nbt_interface *iface, struct nbt_name *name,
- uint16_t nb_flags)
+struct nbt_iface_name *nbtd_find_iname(struct nbt_interface *iface,
+ struct nbt_name *name,
+ uint16_t nb_flags)
{
struct nbt_iface_name *iname;
for (iname=iface->names;iname;iname=iname->next) {
@@ -62,11 +63,11 @@ struct nbt_iface_name *nbt_find_iname(struct nbt_interface *iface, struct nbt_na
/*
start listening on the given address
*/
-static NTSTATUS nbt_add_socket(struct nbt_server *nbtsrv,
- const char *bind_address,
- const char *address,
- const char *bcast,
- const char *netmask)
+static NTSTATUS nbtd_add_socket(struct nbt_server *nbtsrv,
+ const char *bind_address,
+ const char *address,
+ const char *bcast,
+ const char *netmask)
{
struct nbt_interface *iface;
NTSTATUS status;
@@ -101,7 +102,7 @@ static NTSTATUS nbt_add_socket(struct nbt_server *nbtsrv,
return status;
}
- nbt_set_incoming_handler(bcast_nbtsock, nbt_request_handler, iface);
+ nbt_set_incoming_handler(bcast_nbtsock, nbtd_request_handler, iface);
}
iface->nbtsock = nbt_name_socket_init(iface, nbtsrv->task->event_ctx);
@@ -118,7 +119,7 @@ static NTSTATUS nbt_add_socket(struct nbt_server *nbtsrv,
/* we need to be able to send broadcasts out */
socket_set_option(iface->nbtsock->sock, "SO_BROADCAST", "1");
- nbt_set_incoming_handler(iface->nbtsock, nbt_request_handler, iface);
+ nbt_set_incoming_handler(iface->nbtsock, nbtd_request_handler, iface);
if (strcmp(netmask, "0.0.0.0") == 0) {
DLIST_ADD(nbtsrv->bcast_interface, iface);
@@ -133,7 +134,7 @@ static NTSTATUS nbt_add_socket(struct nbt_server *nbtsrv,
/*
setup our listening sockets on the configured network interfaces
*/
-NTSTATUS nbt_startup_interfaces(struct nbt_server *nbtsrv)
+NTSTATUS nbtd_startup_interfaces(struct nbt_server *nbtsrv)
{
int num_interfaces = iface_count();
int i;
@@ -157,11 +158,11 @@ NTSTATUS nbt_startup_interfaces(struct nbt_server *nbtsrv)
primary_address = talloc_strdup(tmp_ctx, primary_address);
NT_STATUS_HAVE_NO_MEMORY(primary_address);
- status = nbt_add_socket(nbtsrv,
- "0.0.0.0",
- primary_address,
- talloc_strdup(tmp_ctx, "255.255.255.255"),
- talloc_strdup(tmp_ctx, "0.0.0.0"));
+ status = nbtd_add_socket(nbtsrv,
+ "0.0.0.0",
+ primary_address,
+ talloc_strdup(tmp_ctx, "255.255.255.255"),
+ talloc_strdup(tmp_ctx, "0.0.0.0"));
NT_STATUS_NOT_OK_RETURN(status);
}
@@ -170,7 +171,7 @@ NTSTATUS nbt_startup_interfaces(struct nbt_server *nbtsrv)
const char *bcast = talloc_strdup(tmp_ctx, sys_inet_ntoa(*iface_n_bcast(i)));
const char *netmask = talloc_strdup(tmp_ctx, sys_inet_ntoa(*iface_n_netmask(i)));
- status = nbt_add_socket(nbtsrv, address, address, bcast, netmask);
+ status = nbtd_add_socket(nbtsrv, address, address, bcast, netmask);
NT_STATUS_NOT_OK_RETURN(status);
}
diff --git a/source4/nbt_server/nbt_server.c b/source4/nbt_server/nbt_server.c
index 1a8872b458..d312269a19 100644
--- a/source4/nbt_server/nbt_server.c
+++ b/source4/nbt_server/nbt_server.c
@@ -45,14 +45,14 @@ static void nbtd_task_init(struct task_server *task)
nbtsrv->bcast_interface = NULL;
/* start listening on the configured network interfaces */
- status = nbt_startup_interfaces(nbtsrv);
+ status = nbtd_startup_interfaces(nbtsrv);
if (!NT_STATUS_IS_OK(status)) {
task_terminate(task, "nbtd failed to setup interfaces");
return;
}
/* start the process of registering our names on all interfaces */
- nbt_register_names(nbtsrv);
+ nbtd_register_names(nbtsrv);
}
diff --git a/source4/nbt_server/nbt_server.h b/source4/nbt_server/nbt_server.h
index 602d7b2e46..d7c85d77f2 100644
--- a/source4/nbt_server/nbt_server.h
+++ b/source4/nbt_server/nbt_server.h
@@ -65,7 +65,7 @@ struct nbt_server {
/* check a condition on an incoming packet */
#define NBT_ASSERT_PACKET(packet, src_address, test) do { \
if (!(test)) { \
- nbt_bad_packet(packet, src_address, #test); \
+ nbtd_bad_packet(packet, src_address, #test); \
return; \
} \
} while (0)
diff --git a/source4/nbt_server/nodestatus.c b/source4/nbt_server/nodestatus.c
index 36c3707374..0d0fbb8086 100644
--- a/source4/nbt_server/nodestatus.c
+++ b/source4/nbt_server/nodestatus.c
@@ -28,11 +28,11 @@
/*
send a name status reply
*/
-static void nbt_node_status_reply(struct nbt_name_socket *nbtsock,
- struct nbt_name_packet *request_packet,
- const char *src_address, int src_port,
- struct nbt_name *name,
- struct nbt_interface *iface)
+static void nbtd_node_status_reply(struct nbt_name_socket *nbtsock,
+ struct nbt_name_packet *request_packet,
+ const char *src_address, int src_port,
+ struct nbt_name *name,
+ struct nbt_interface *iface)
{
struct nbt_name_packet *packet;
uint32_t name_count;
@@ -95,9 +95,9 @@ failed:
/*
answer a node status query
*/
-void nbt_query_status(struct nbt_name_socket *nbtsock,
- struct nbt_name_packet *packet,
- const char *src_address, int src_port)
+void nbtd_query_status(struct nbt_name_socket *nbtsock,
+ struct nbt_name_packet *packet,
+ const char *src_address, int src_port)
{
struct nbt_name *name;
struct nbt_iface_name *iname;
@@ -111,12 +111,13 @@ void nbt_query_status(struct nbt_name_socket *nbtsock,
/* see if we have the requested name on this interface */
name = &packet->questions[0].name;
- iname = nbt_find_iname(iface, name, NBT_NM_ACTIVE);
+ iname = nbtd_find_iname(iface, name, NBT_NM_ACTIVE);
if (iname == NULL) {
DEBUG(7,("Node status query for %s<%02x> from %s - not found on %s\n",
name->name, name->type, src_address, iface->ip_address));
return;
}
- nbt_node_status_reply(nbtsock, packet, src_address, src_port, &iname->name, iface);
+ nbtd_node_status_reply(nbtsock, packet, src_address, src_port,
+ &iname->name, iface);
}
diff --git a/source4/nbt_server/packet.c b/source4/nbt_server/packet.c
index 53ccc4d93f..337c77f33a 100644
--- a/source4/nbt_server/packet.c
+++ b/source4/nbt_server/packet.c
@@ -27,8 +27,8 @@
/*
we received a badly formed packet - log it
*/
-void nbt_bad_packet(struct nbt_name_packet *packet,
- const char *src_address, const char *reason)
+void nbtd_bad_packet(struct nbt_name_packet *packet,
+ const char *src_address, const char *reason)
{
DEBUG(2,("nbtd: bad packet '%s' from %s\n", reason, src_address));
if (DEBUGLVL(5)) {
diff --git a/source4/nbt_server/query.c b/source4/nbt_server/query.c
index 6dab18cfbe..911163f19e 100644
--- a/source4/nbt_server/query.c
+++ b/source4/nbt_server/query.c
@@ -28,11 +28,11 @@
/*
send a name query reply
*/
-static void nbt_name_query_reply(struct nbt_name_socket *nbtsock,
- struct nbt_name_packet *request_packet,
- const char *src_address, int src_port,
- struct nbt_name *name, uint32_t ttl,
- uint16_t nb_flags, const char *address)
+static void nbtd_name_query_reply(struct nbt_name_socket *nbtsock,
+ struct nbt_name_packet *request_packet,
+ const char *src_address, int src_port,
+ struct nbt_name *name, uint32_t ttl,
+ uint16_t nb_flags, const char *address)
{
struct nbt_name_packet *packet;
@@ -77,9 +77,9 @@ failed:
/*
answer a name query
*/
-void nbt_request_query(struct nbt_name_socket *nbtsock,
- struct nbt_name_packet *packet,
- const char *src_address, int src_port)
+void nbtd_request_query(struct nbt_name_socket *nbtsock,
+ struct nbt_name_packet *packet,
+ const char *src_address, int src_port)
{
struct nbt_iface_name *iname;
struct nbt_name *name;
@@ -89,14 +89,14 @@ void nbt_request_query(struct nbt_name_socket *nbtsock,
/* see if its a node status query */
if (packet->qdcount == 1 &&
packet->questions[0].question_type == NBT_QTYPE_STATUS) {
- nbt_query_status(nbtsock, packet, src_address, src_port);
+ nbtd_query_status(nbtsock, packet, src_address, src_port);
return;
}
/* if its a WINS query then direct to our WINS server */
if ((packet->operation & NBT_FLAG_RECURSION_DESIRED) &&
!(packet->operation & NBT_FLAG_BROADCAST)) {
- nbt_query_wins(nbtsock, packet, src_address, src_port);
+ nbtd_query_wins(nbtsock, packet, src_address, src_port);
return;
}
@@ -107,14 +107,14 @@ void nbt_request_query(struct nbt_name_socket *nbtsock,
/* see if we have the requested name on this interface */
name = &packet->questions[0].name;
- iname = nbt_find_iname(iface, name, NBT_NM_ACTIVE);
+ iname = nbtd_find_iname(iface, name, NBT_NM_ACTIVE);
if (iname == NULL) {
DEBUG(7,("Query for %s<%02x> from %s - not found on %s\n",
name->name, name->type, src_address, iface->ip_address));
return;
}
- nbt_name_query_reply(nbtsock, packet, src_address, src_port,
- &iname->name, iname->ttl, iname->nb_flags,
- iface->ip_address);
+ nbtd_name_query_reply(nbtsock, packet, src_address, src_port,
+ &iname->name, iname->ttl, iname->nb_flags,
+ iface->ip_address);
}
diff --git a/source4/nbt_server/register.c b/source4/nbt_server/register.c
index b11ebcc01e..7464b2fbe2 100644
--- a/source4/nbt_server/register.c
+++ b/source4/nbt_server/register.c
@@ -29,7 +29,7 @@
#include "libcli/composite/composite.h"
-static void nbt_start_refresh_timer(struct nbt_iface_name *iname);
+static void nbtd_start_refresh_timer(struct nbt_iface_name *iname);
/*
a name refresh request has completed
@@ -46,7 +46,7 @@ static void refresh_completion_handler(struct nbt_name_request *req)
DEBUG(4,("Refreshed name %s<%02x> on %s\n",
iname->name.name, iname->name.type, iname->iface->ip_address));
iname->registration_time = timeval_current();
- nbt_start_refresh_timer(iname);
+ nbtd_start_refresh_timer(iname);
talloc_free(tmp_ctx);
return;
}
@@ -99,7 +99,7 @@ static void name_refresh_handler(struct event_context *ev, struct timed_event *t
/*
start a timer to refresh this name
*/
-static void nbt_start_refresh_timer(struct nbt_iface_name *iname)
+static void nbtd_start_refresh_timer(struct nbt_iface_name *iname)
{
uint32_t refresh_time;
uint32_t max_refresh_time = lp_parm_int(-1, "nbtd", "max_refresh_time", 7200);
@@ -116,9 +116,10 @@ static void nbt_start_refresh_timer(struct nbt_iface_name *iname)
/*
a name registration has completed
*/
-static void nbt_register_handler(struct composite_context *req)
+static void nbtd_register_handler(struct composite_context *req)
{
- struct nbt_iface_name *iname = talloc_get_type(req->async.private, struct nbt_iface_name);
+ struct nbt_iface_name *iname = talloc_get_type(req->async.private,
+ struct nbt_iface_name);
NTSTATUS status;
status = nbt_name_register_bcast_recv(req);
@@ -128,7 +129,7 @@ static void nbt_register_handler(struct composite_context *req)
DEBUG(3,("Registered %s<%02x> on interface %s\n",
iname->name.name, iname->name.type, iname->iface->bcast_address));
iname->registration_time = timeval_current();
- nbt_start_refresh_timer(iname);
+ nbtd_start_refresh_timer(iname);
return;
}
@@ -144,9 +145,9 @@ static void nbt_register_handler(struct composite_context *req)
/*
register a name on a network interface
*/
-static void nbt_register_name_iface(struct nbt_interface *iface,
- const char *name, enum nbt_name_type type,
- uint16_t nb_flags)
+static void nbtd_register_name_iface(struct nbt_interface *iface,
+ const char *name, enum nbt_name_type type,
+ uint16_t nb_flags)
{
struct nbt_iface_name *iname;
const char *scope = lp_netbios_scope();
@@ -187,7 +188,7 @@ static void nbt_register_name_iface(struct nbt_interface *iface,
req = nbt_name_register_bcast_send(iface->nbtsock, &io);
if (req == NULL) return;
- req->async.fn = nbt_register_handler;
+ req->async.fn = nbtd_register_handler;
req->async.private = iname;
}
@@ -195,21 +196,21 @@ static void nbt_register_name_iface(struct nbt_interface *iface,
/*
register one name on all our interfaces
*/
-static void nbt_register_name(struct nbt_server *nbtsrv,
- const char *name, enum nbt_name_type type,
- uint16_t nb_flags)
+static void nbtd_register_name(struct nbt_server *nbtsrv,
+ const char *name, enum nbt_name_type type,
+ uint16_t nb_flags)
{
struct nbt_interface *iface;
/* register with all the local interfaces */
for (iface=nbtsrv->interfaces;iface;iface=iface->next) {
- nbt_register_name_iface(iface, name, type, nb_flags);
+ nbtd_register_name_iface(iface, name, type, nb_flags);
}
/* register on our general broadcast interface as a permanent name */
if (nbtsrv->bcast_interface) {
- nbt_register_name_iface(nbtsrv->bcast_interface, name, type,
- nb_flags | NBT_NM_PERMANENT);
+ nbtd_register_name_iface(nbtsrv->bcast_interface, name, type,
+ nb_flags | NBT_NM_PERMANENT);
}
/* TODO: register with our WINS servers */
@@ -219,21 +220,21 @@ static void nbt_register_name(struct nbt_server *nbtsrv,
/*
register our names on all interfaces
*/
-void nbt_register_names(struct nbt_server *nbtsrv)
+void nbtd_register_names(struct nbt_server *nbtsrv)
{
uint16_t nb_flags = NBT_NODE_M;
/* note that we don't initially mark the names "ACTIVE". They are
marked active once registration is successful */
- nbt_register_name(nbtsrv, lp_netbios_name(), NBT_NAME_CLIENT, nb_flags);
- nbt_register_name(nbtsrv, lp_netbios_name(), NBT_NAME_USER, nb_flags);
- nbt_register_name(nbtsrv, lp_netbios_name(), NBT_NAME_SERVER, nb_flags);
+ nbtd_register_name(nbtsrv, lp_netbios_name(), NBT_NAME_CLIENT, nb_flags);
+ nbtd_register_name(nbtsrv, lp_netbios_name(), NBT_NAME_USER, nb_flags);
+ nbtd_register_name(nbtsrv, lp_netbios_name(), NBT_NAME_SERVER, nb_flags);
nb_flags |= NBT_NM_GROUP;
- nbt_register_name(nbtsrv, lp_workgroup(), NBT_NAME_CLIENT, nb_flags);
+ nbtd_register_name(nbtsrv, lp_workgroup(), NBT_NAME_CLIENT, nb_flags);
nb_flags |= NBT_NM_PERMANENT;
- nbt_register_name(nbtsrv, "__SAMBA__", NBT_NAME_CLIENT, nb_flags);
- nbt_register_name(nbtsrv, "__SAMBA__", NBT_NAME_SERVER, nb_flags);
- nbt_register_name(nbtsrv, "*", NBT_NAME_CLIENT, nb_flags);
+ nbtd_register_name(nbtsrv, "__SAMBA__", NBT_NAME_CLIENT, nb_flags);
+ nbtd_register_name(nbtsrv, "__SAMBA__", NBT_NAME_SERVER, nb_flags);
+ nbtd_register_name(nbtsrv, "*", NBT_NAME_CLIENT, nb_flags);
}
diff --git a/source4/nbt_server/winsserver.c b/source4/nbt_server/winsserver.c
index 7810bebd24..44216a1cb5 100644
--- a/source4/nbt_server/winsserver.c
+++ b/source4/nbt_server/winsserver.c
@@ -27,9 +27,9 @@
/*
answer a name query
*/
-void nbt_query_wins(struct nbt_name_socket *nbtsock,
- struct nbt_name_packet *packet,
- const char *src_address, int src_port)
+void nbtd_query_wins(struct nbt_name_socket *nbtsock,
+ struct nbt_name_packet *packet,
+ const char *src_address, int src_port)
{
DEBUG(0,("WINS query from %s\n", src_address));
if (DEBUGLVL(10)) {