dlprims.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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI" /* SunOS */
#include <stdio.h>
#include <stdarg.h>
#include "snoop.h"
#define DLMAXBUF (256)
static void sigalrm(int);
static void err(const char *, ...);
static void syserr(char *);
/*
* Issue DL_INFO_REQ and wait for DL_INFO_ACK.
*/
void
{
union DL_primitives *dlp;
int flags;
syserr("dlinforeq: putmsg");
err("dlinfoack: DL_INFO_ACK was not M_PCPROTO");
if (infoackp)
}
/*
* Issue DL_ATTACH_REQ.
* Return zero on success, nonzero on error.
*/
void
{
union DL_primitives *dlp;
int flags;
flags = 0;
syserr("dlattachreq: putmsg");
}
/*
* Issue DL_PROMISCON_REQ and wait for DL_OK_ACK.
*/
void
{
union DL_primitives *dlp;
int flags;
flags = 0;
syserr("dlpromiscon: putmsg");
}
void
{
union DL_primitives *dlp;
int flags;
flags = 0;
syserr("dlbindreq: putmsg");
}
/* ARGSUSED */
static void
{
(void) err("sigalrm: TIMEOUT");
}
void
char *caller)
{
int rc;
static char errmsg[80];
/*
* Start timer.
*/
}
/*
* Set flags argument and issue getmsg().
*/
*flagsp = 0;
}
/*
* Stop timer.
*/
if (snoop_alarm(0, sigalrm) < 0) {
}
/*
*/
/*
* Check for at least sizeof (long) control data portion.
*/
err("%s: control portion length < sizeof (long)",
caller);
}
char *
show_dltype(int dl_errno)
{
switch (dl_errno) {
case DL_ACCESS: /* Improper permissions for request */
return ("Improper permissions for request");
case DL_BADADDR:
return ("DLSAP addr in improper format or invalid");
case DL_BADCORR: /* Seq number not from outstand DL_CONN_IND */
return ("Seq number not from outstand DL_CONN_IND");
case DL_BADDATA: /* User data exceeded provider limit */
return ("User data exceeded provider limit");
case DL_BADPPA: /* Specified PPA was invalid */
return ("Specified PPA was invalid");
case DL_BADPRIM: /* Primitive received not known by provider */
return ("Primitive received not known by provider");
case DL_BADQOSPARAM: /* QOS parameters contained invalid values */
return ("QOS parameters contained invalid values");
case DL_BADQOSTYPE: /* QOS structure type is unknown/unsupported */
return ("QOS structure type is unknown/unsupported");
case DL_BADSAP: /* Bad LSAP selector */
return ("Bad LSAP selector");
case DL_BADTOKEN: /* Token used not an active stream */
return ("Token used not an active stream");
case DL_BOUND: /* Attempted second bind with dl_max_conind */
return ("Attempted second bind with dl_max_conind");
case DL_INITFAILED: /* Physical Link initialization failed */
return ("Physical Link initialization failed");
case DL_NOADDR: /* Provider couldn't allocate alt. address */
return ("Provider couldn't allocate alt. address");
case DL_NOTINIT: /* Physical Link not initialized */
return ("Physical Link not initialized");
case DL_OUTSTATE: /* Primitive issued in improper state */
return ("Primitive issued in improper state");
case DL_SYSERR: /* UNIX system error occurred */
return ("UNIX system error occurred");
case DL_UNSUPPORTED: /* Requested serv. not supplied by provider */
return ("Requested serv. not supplied by provider");
case DL_UNDELIVERABLE: /* Previous data unit could not be delivered */
return ("Previous data unit could not be delivered");
case DL_NOTSUPPORTED: /* Primitive is known but not supported */
return ("Primitive is known but not supported");
case DL_TOOMANY: /* limit exceeded */
return ("Limit exceeded");
case DL_NOTENAB: /* Promiscuous mode not enabled */
return ("Promiscuous mode not enabled");
case DL_BUSY: /* Other streams for PPA in post-attached */
return ("Other streams for PPA in post-attached");
case DL_NOAUTO: /* Automatic handling XID&TEST not supported */
return ("Automatic handling XID&TEST not supported");
case DL_NOXIDAUTO: /* Automatic handling of XID not supported */
return ("Automatic handling of XID not supported");
case DL_NOTESTAUTO: /* Automatic handling of TEST not supported */
return ("Automatic handling of TEST not supported");
case DL_XIDAUTO: /* Automatic handling of XID response */
return ("Automatic handling of XID response");
case DL_TESTAUTO: /* AUtomatic handling of TEST response */
return ("Automatic handling of TEST response");
case DL_PENDING: /* pending outstanding connect indications */
return ("Pending outstanding connect indications");
}
return ("Unknown DLPI error");
}
int
{
err("%s: DL_ERROR_ACK: dl_errno %d unix_errno %d\n",
return (1);
}
err("%s: unexpected primitive 0x%x received\n",
dlp->dl_primitive);
return (1);
}
return (0);
}
static void
{
exit(1);
}
void
syserr(char *s)
{
perror(s);
exit(1);
}