2005-01-30 10:24:36 +00:00
/*
Unix SMB / CIFS implementation .
NBT server task
Copyright ( C ) Andrew Tridgell 2005
This program is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation ; either version 2 of the License , or
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program ; if not , write to the Free Software
Foundation , Inc . , 675 Mass Ave , Cambridge , MA 0213 9 , USA .
*/
# include "includes.h"
2005-02-03 11:56:03 +00:00
# include "lib/events/events.h"
2005-01-30 10:24:36 +00:00
# include "smbd/service_task.h"
# include "nbt_server/nbt_server.h"
/*
startup the nbtd task
*/
static void nbtd_task_init ( struct task_server * task )
{
struct nbt_server * nbtsrv ;
2005-01-30 10:41:15 +00:00
NTSTATUS status ;
2005-01-30 10:24:36 +00:00
nbtsrv = talloc ( task , struct nbt_server ) ;
if ( nbtsrv = = NULL ) {
task_terminate ( task , " nbtd: out of memory " ) ;
return ;
}
2005-01-31 01:57:58 +00:00
nbtsrv - > task = task ;
nbtsrv - > interfaces = NULL ;
nbtsrv - > bcast_interface = NULL ;
2005-01-30 10:24:36 +00:00
2005-01-30 10:41:15 +00:00
/* start listening on the configured network interfaces */
status = nbt_startup_interfaces ( nbtsrv ) ;
if ( ! NT_STATUS_IS_OK ( status ) ) {
task_terminate ( task , " nbtd failed to setup interfaces " ) ;
return ;
}
2005-01-30 10:24:36 +00:00
2005-01-31 01:57:58 +00:00
/* start the process of registering our names on all interfaces */
nbt_register_names ( nbtsrv ) ;
2005-01-30 10:24:36 +00:00
}
/*
initialise the nbt server
*/
static NTSTATUS nbtd_init ( struct event_context * event_ctx , const struct model_ops * model_ops )
{
return task_server_startup ( event_ctx , model_ops , nbtd_task_init ) ;
}
/*
register ourselves as a available server
*/
NTSTATUS server_service_nbtd_init ( void )
{
return register_server_service ( " nbt " , nbtd_init ) ;
}