dkdial.c revision 61961e0f20c7637a3846bb39786bb9dffa91dfb9
/*
* 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 */
#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
/*
* create a Datakit connection to a remote destination
*/
#ifndef DIAL
#endif
/*
* COMMKIT(TM) Software - Datakit(R) VCS Interface Release 2.0 V1
* Copyright 1984 AT&T
* All Rights Reserved
*/
#include <fcntl.h>
#include "dk.h"
#include <stdio.h>
#include <signal.h>
#define SIGRTN void
#include <setjmp.h>
#include <sysexits.h>
#include <errno.h>
static char Conn_Msg[] = "Can't connect to %s: %s\n";
static char Resp_Msg[] = "No response from Datakit";
static int Elapsed; /* Alarm time elapsed during dial */
static int Timer; /* Current alarm setting */
static short TimeErr; /* Alarm clock rang */
extern char *getenv();
GLOBAL int
char *dest;
{
int dummy;
return (dummy);
}
GLOBAL int
char *dest;
{
short fd; /* Channel Descriptor */
unsigned int TimWas; /* Caller's alarm clock */
char *key;
struct diocdial {
char dialstring[128];
} ioreq;
char dial_dev[32];
int dummy;
trace1(TR_dkndial, 0);
/*
** Clear our elapsed time and save caller's alarm stuff.
*/
/*
** If requested timeout interval is unreasonable, use the default.
*/
/*
** Do an alarm protected open of the dial device
*/
setalarm(0);
if (dk_verbose)
return (dk_errno = -EX_TEMPFAIL);
}
else {
}
}
/*
** If the caller has a DKKEY, use it.
*/
else
/*
** Try to dial the call. If the alarm expires during the ioctl,
** the ioctl will return in error.
*/
setalarm(0);
if (dk_verbose)
if (TimeErr)
else
return (dummy);
}
else {
return (dummy);
}
}
return (fd);
}
/*
** timout() is the alarm clock signal handling routine. It is called
** whenever the alarm clock expires during dial processing.
*/
/* ARGSUSED */
static SIGRTN
int arg;
{
TimeErr++;
}
/*
** setalarm() is called to request an alarm at a future time. The residual
** from the previous alarm (if any) is added to the elapsed time counter.
*/
static void
{
trace1(TR_setalarm, 0);
TimeErr = 0;
}
/*
** usralarm() is used to restore the alarm service for the caller.
*/
static void
int TimWas; /* Caller's alarm clock */
{
if (TimWas > 0) {
if (TimWas < 2)
TimWas = 2;
}
}