/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* for the NETBIOS layer.
*/
#include <assert.h>
#include <synch.h>
#include <unistd.h>
#include <syslog.h>
#include <string.h>
#include <strings.h>
#include <stdio.h>
#include <pwd.h>
#include <grp.h>
#include <smbns_netbios.h>
static void smb_netbios_shutdown(void);
static void *smb_netbios_service(void *);
static void smb_netbios_dump(void);
/*
* Start the NetBIOS services
*/
int
smb_netbios_start(void)
{
int rc;
if (smb_netbios_cache_init() < 0)
return (-1);
(void) pthread_attr_init(&attr);
(void) pthread_attr_destroy(&attr);
return (rc);
}
/*
* Stop the NetBIOS services
*/
void
smb_netbios_stop(void)
{
}
/*
* Launch the NetBIOS Name Service, Datagram and Browser services
* and then sit in a loop providing a 1 second resolution timer.
* The timer will:
* - update the netbios stats file every 10 minutes
* - clean the cache every 10 minutes
*/
/*ARGSUSED*/
static void *
{
int rc;
if (rc != 0) {
return (NULL);
}
if (smb_netbios_error()) {
return (NULL);
}
if (rc != 0) {
return (NULL);
}
if (smb_netbios_error()) {
return (NULL);
}
if (rc != 0) {
return (NULL);
}
for (;;) {
(void) sleep(1);
ticks++;
if (!smb_netbios_running())
break;
if ((ticks % 600) == 0) {
}
}
return (NULL);
}
static void
smb_netbios_shutdown(void)
{
if (smb_netbios_error()) {
if (smb_netbios_start() != 0)
}
}
int
{
}
int
{
}
/*
* smb_encode_netbios_name
*
* Set up the name and scope fields in the destination name_entry structure.
* The name is padded with spaces to 15 bytes. The suffix is copied into the
* last byte, i.e. "netbiosname <suffix>". The scope is copied and folded
* to uppercase.
*/
void
struct name_entry *dest)
{
if (scope) {
} else {
}
}
void
{
switch (smb_node_type) {
case 'H':
break;
case 'M':
break;
case 'P':
break;
case 'B':
default:
break;
}
}
void
{
static char *event_msg[] = {
"startup",
"shutdown",
"restart",
"name service started",
"name service stopped",
"datagram service started",
"datagram service stopped",
"browser service started",
"browser service stopped",
"timer service started",
"timer service stopped",
"error",
"dump"
};
if (event == NETBIOS_EVENT_DUMP) {
return;
}
case NETBIOS_STATE_INIT:
if (event == NETBIOS_EVENT_START)
break;
case NETBIOS_STATE_RUNNING:
switch (event) {
case NETBIOS_EVENT_NS_START:
break;
case NETBIOS_EVENT_NS_STOP:
break;
case NETBIOS_EVENT_DGM_START:
break;
case NETBIOS_EVENT_DGM_STOP:
break;
break;
break;
break;
case NETBIOS_EVENT_TIMER_STOP:
break;
case NETBIOS_EVENT_STOP:
break;
case NETBIOS_EVENT_ERROR:
++nbtd.nbs_errors;
break;
default:
break;
}
break;
case NETBIOS_STATE_CLOSING:
case NETBIOS_STATE_ERROR:
default:
switch (event) {
case NETBIOS_EVENT_NS_STOP:
break;
case NETBIOS_EVENT_DGM_STOP:
break;
break;
case NETBIOS_EVENT_TIMER_STOP:
break;
case NETBIOS_EVENT_STOP:
break;
case NETBIOS_EVENT_RESET:
break;
case NETBIOS_EVENT_ERROR:
++nbtd.nbs_errors;
break;
default:
break;
}
break;
}
}
void
{
switch (event) {
case NETBIOS_EVENT_NS_START:
case NETBIOS_EVENT_NS_STOP:
break;
case NETBIOS_EVENT_DGM_START:
case NETBIOS_EVENT_DGM_STOP:
break;
break;
default:
return;
}
while (*svc != desired_state) {
break;
}
}
void
{
if (seconds == 0)
seconds = 1;
reltimeout.tv_nsec = 0;
}
}
smb_netbios_running(void)
{
is_running = B_TRUE;
else
return (is_running);
}
smb_netbios_error(void)
{
else
return (error);
}
/*
*
* This is a private interface. To update the file use:
* smb_netbios_event(NETBIOS_EVENT_DUMP);
*/
static void
smb_netbios_dump(void)
{
static struct {
char *text;
} sm[] = {
{ NETBIOS_STATE_INIT, "init" },
{ NETBIOS_STATE_RUNNING, "running" },
{ NETBIOS_STATE_CLOSING, "closing" },
{ NETBIOS_STATE_ERROR, "error" }
};
int i;
return;
if (nbtd.nbs_last_event)
"State %s (event: %s, errors: %u)\n",
break;
}
}
}