interface.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* 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 1997 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#pragma ident "%Z%%M% %I% %E% SMI"
/* interface( label )
provide alternate definitions for the I/O functions through global
interfaces.
*/
#include "uucp.h"
#ifdef TLI
#include <tiuser.h>
char *t_alloc();
#endif /* TLI */
#ifdef DATAKIT
#include "dk.h"
static int dksetup();
static int dkteardown();
#endif /* DATAKIT */
#if defined(__STDC__)
extern int ioctl(int, int, ...);
#else
extern int ioctl();
#endif
#if defined(__STDC__)
#else
#endif
#ifdef TLI
#ifdef __STDC__
static int tioctl(int, int, ...),
#else
static int tioctl(), /* TLI i/o control */
#endif
tsetup(), /* TLI setup without streams module */
tssetup(), /* TLI setup with streams module */
tteardown(); /* 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 {
char *IN_label; /* interface name */
#ifdef __STDC__
int (*IN_ioctl)(int,int,...);
#else
int (*IN_ioctl)(); /* ioctl function */
#endif
int (*IN_setup)(); /* setup function, called before first
i/o operation */
int (*IN_teardown)(); /* teardown function, called after last
i/o operation */
} Interface[] = {
/* vanilla UNIX */
#ifdef TCP
/* TCP over sockets or UNET */
#endif /* TCP */
#ifdef SYTEK
/* Sytek network */
#endif /* Sytek network */
#ifdef DIAL801
/* 801 auto dialers */
#endif /* DIAL801 */
#ifdef DIAL801
/* 212 auto dialers */
#endif /* DIAL801 */
#ifdef TLI
/* AT&T Transport Interface Library WITHOUT streams */
#ifdef TLIS
/* AT&T Transport Interface Library WITH streams */
#endif /* TLIS */
#endif /* TLI */
#ifdef DATAKIT
#endif /* DATAKIT */
#ifdef UNET
#endif
{ 0, 0, 0, 0, 0, 0 }
};
GLOBAL int
char *label;
{
register 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
{
int ret;
char *ttyn;
if (fdread != -1)
}
if (fdread != -1) {
}
return(SUCCESS);
}
#ifdef DATAKIT
/*
* dksetup - DATAKIT setup routine
*
* Put line in block mode.
*/
static int
int role;
int * fdreadp;
int * fdwritep;
{
int ret;
return(FAIL);
}
return(SUCCESS);
}
/*
* dkteardown - DATAKIT teardown routine
*/
static int
{
char *ttyn;
}
/* must flush fd's for datakit */
/* else close can hang */
return(SUCCESS);
}
#endif /* DATAKIT */
#ifdef TLI
/*
* tread - tli read routine
*/
static ssize_t
int fd;
char *buf;
unsigned nbytes;
{
int rcvflags;
}
/*
* twrite - tli write routine
*/
#define N_CHECK 100
static ssize_t
int fd;
char *buf;
unsigned nbytes;
{
register 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
#ifdef __STDC__
#else
#endif
{
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
int role;
int *fdreadp;
int *fdwritep;
{
*fdreadp = 0;
*fdwritep = 1;
/* 2 has been re-opened to RMTDEBUG in main() */
return(SUCCESS);
}
return(SUCCESS);
}
/*
* Report why a TLI call failed.
*/
GLOBAL void
int fd;
char *s;
{
extern char *sys_errlist[];
show_tlook(fd);
}
} else {
}
return;
}
GLOBAL void
int fd;
{
register int reason;
register char *msg;
extern int t_errno;
/*
* Find out the current state of the interface.
*/
}
return;
case 0: msg = "NO ERROR"; break;
default: msg = "UNKNOWN ERROR"; break;
}
if ( reason == T_DISCONNECT )
{
if ( ((dropped =
if (dropped)
return;
}
}
return;
}
#endif /* TLIS */
#endif /* TLI */