/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright 2014 Gary Mills
*/
/*
* interface( label )
* provide alternate definitions for the I/O functions through global
* interfaces.
*/
#include "mt.h"
#include "uucp.h"
#include <unistd.h>
#ifdef TLI
#include <tiuser.h>
#endif /* TLI */
static void sethup(int);
static int restline(void);
static int usetup(int, int *, int *);
static int uteardown(int, int, int);
#ifdef TLI
static void show_tlook(int);
static int tioctl(int, int, ...);
static int tsetup(int, int *, int *); /* TLI setup without streams module */
static int tssetup(int, int *, int *); /* TLI setup with streams module */
static int tteardown(int, int, int); /* TLI teardown, works with either setup */
#endif /* TLI */
/*
* The IN_label in Interface[] imply different caller routines:
* e.g. tlicall().
* If so, the names here and the names in callers.c must match.
*/
static struct Interface {
int (*IN_ioctl)(int, int, ...);
/* first i/o operation */
/* last i/o operation */
} Interface[] = {
/* vanilla UNIX */
#ifdef TLI
/* AT&T Transport Interface Library WITHOUT streams */
#ifdef TLIS
/* AT&T Transport Interface Library WITH streams */
#endif /* TLIS */
#endif /* TLI */
{ 0, 0, 0, 0, 0, 0 }
};
static int
{
int i;
return (0);
}
}
return (FAIL);
}
/*
* usetup - vanilla unix setup routine
*/
static int
{
*fdreadp = 0;
*fdwritep = 1;
/* 2 has been re-opened to RMTDEBUG in main() */
}
return (SUCCESS);
}
/*
* uteardown - vanilla unix teardown routine
*/
static int
{
char *ttyn;
(void) restline();
sethup(0);
}
if (fdread != -1) {
/* can fail, but who cares? */
}
return (SUCCESS);
}
#ifdef TLI
/*
* tread - tli read routine
*/
static ssize_t
{
int rcvflags;
}
/*
* twrite - tli write routine
*/
static ssize_t
{
int i, ret;
if (got_info == 0) {
return (FAIL);
}
got_info = 1;
}
/* on every N_CHECKth call, check that are still in DATAXFER state */
n_writ = 0;
return (FAIL);
}
/* if get here, then there is a limit on transmit size */
/* (info.tsdu > 0) and buf exceeds it */
i = ret = 0;
}
if (nbytes != 0) {
i += nbytes;
}
return ((ssize_t)i);
}
/*
* tioctl - stub for tli ioctl routine
*/
/* ARGSUSED */
static int
{
return (SUCCESS);
}
/*
* tsetup - tli setup routine
* note blatant assumption that *fdreadp == *fdwritep == 0
*/
static int
{
*fdreadp = 0;
*fdwritep = 1;
/* 2 has been re-opened to RMTDEBUG in main() */
return (FAIL);
}
}
return (SUCCESS);
}
/*
* tteardown - tli shutdown routine
*/
/* ARGSUSED */
static int
{
return (SUCCESS);
}
#ifdef TLIS
/*
* tssetup - tli, with streams module, setup routine
* note blatant assumption that *fdreadp == *fdwritep
*/
static int
{
*fdreadp = 0;
*fdwritep = 1;
/* 2 has been re-opened to RMTDEBUG in main() */
return (SUCCESS);
}
return (SUCCESS);
}
/*
* Report why a TLI call failed.
*/
static void
{
show_tlook(fd);
}
} else {
"unknown tli error %d", t_errno);
"%s: unknown tli error %d", s, t_errno);
}
}
static void
{
int reason;
const char *msg;
/*
* Find out the current state of the interface.
*/
}
return;
case 0: msg = (const char *)"NO ERROR"; break;
default: msg = (const char *)"UNKNOWN ERROR"; break;
}
if (reason == T_DISCONNECT) {
if (((dropped =
/* LINTED pointer cast */
if (dropped)
return;
}
}
}
#endif /* TLIS */
#endif /* TLI */