smbns_netbios.c revision dc20a3024900c47dd2ee44b9707e6df38f7d62a5
/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* for the NETBIOS layer.
*/
#include <synch.h>
#include <unistd.h>
#include <syslog.h>
#include <string.h>
#include <strings.h>
#include <smbns_netbios.h>
static void *smb_netbios_timer(void *);
void
{
if (set)
else
}
void
smb_netbios_shutdown(void)
{
(void) pthread_join(smb_nbts_thr, 0);
(void) pthread_join(smb_nbbs_thr, 0);
(void) pthread_join(smb_nbns_thr, 0);
(void) pthread_join(smb_nbds_thr, 0);
}
int
smb_netbios_start(void)
{
int rc;
/* Startup Netbios named; port 137 */
if (rc)
return (-1);
(void) mutex_lock(mp);
}
(void) mutex_unlock(mp);
return (-1);
}
(void) mutex_unlock(mp);
/* Startup Netbios datagram service; port 138 */
if (rc != 0) {
return (-1);
}
(void) mutex_lock(mp);
}
(void) mutex_unlock(mp);
return (-1);
}
(void) mutex_unlock(mp);
/* Startup Netbios browser service */
if (rc) {
return (-1);
}
/* Startup Our internal, 1 second resolution, timer */
if (rc != 0) {
return (-1);
}
(void) mutex_lock(mp);
NETBIOS_TIMER_FAILED))) {
}
(void) mutex_unlock(mp);
return (-1);
}
(void) mutex_unlock(mp);
return (0);
}
/*ARGSUSED*/
static void *
smb_netbios_timer(void *arg)
{
static unsigned int ticks;
(void) sleep(1);
else
break;
/* every 10 minutes */
if ((ticks % 600) == 0)
}
else
break;
}
/* either name or datagram service has failed */
}
return (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)
{
char tmp_name[NETBIOS_NAME_SZ];
unsigned int cpid;
int len;
len = 0;
cpid = oem_get_smb_cpid();
if (rc > 0)
}
if (len) {
(void) utf8_strupr(tmp_name);
}
} else {
}
}
void
{
switch (smb_node_type) {
case 'H':
break;
case 'M':
break;
case 'P':
break;
case 'B':
default:
break;
}
}