dlprims.c revision 948f2876ce2a3010558f4f6937e16086ebcd36f2
/*
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* FIXME: from snoop. Use common library when it comes into existence */
#pragma ident "%Z%%M% %I% %E% SMI"
#include <fcntl.h>
#include <stdio.h>
#include <strings.h>
#include <string.h>
#include <stdarg.h>
#include <unistd.h>
#include <stropts.h>
#include <stdlib.h>
#include <ctype.h>
#include <values.h>
#define DLMAXBUF (80)
typedef union dlbuf {
union DL_primitives dl;
} dlbuf_t;
/*
* Issue DL_INFO_REQ and wait for DL_INFO_ACK.
*/
static int
{
int flags;
return (-1);
return (-1);
return (-1);
return (-1);
return (-1);
return (0);
}
/*
* Issue DL_ATTACH_REQ.
* Return zero on success, nonzero on error.
*/
static int
{
int flags;
flags = 0;
return (-1);
return (-1);
return (-1);
return (0);
}
static int
int timeout)
{
int rc;
return (0);
else if (rc == -1)
return (0);
/* poll returned > 0 for this fd so getmsg should not block */
*flagsp = 0;
return (0);
/*
*/
return (-1);
return (-1);
return (-1);
/*
* Check for at least sizeof (long) control data portion.
*/
return (-1);
return (0);
}
static boolean_t
{
return (B_FALSE);
return (B_TRUE);
}
/*
* Convert a device id to a ppa value
* e.g. "le0" -> 0
*/
static int
device_ppa(char *device)
{
char *p;
char *tp;
if (p == NULL)
return (0);
/* ignore numbers within device names */
return (device_ppa(tp));
return (atoi(p));
}
/*
* Convert a device id to a pathname.
*/
static char *
device_path(char *device)
{
char *p;
return (buff);
if (isdigit(*p))
*p = '\0';
else
break;
}
return (buff);
}
/*
* Open up the device, and attach if needed.
*/
int
ifname_open(char *device)
{
char *devname;
int netfd;
/*
* Determine which network device
* to use if none given.
*/
return (-1);
/*
* Check for DLPI Version 2.
*/
return (-1);
}
return (-1);
}
/*
* Attach for DLPI Style 2.
*/
return (-1);
}
/* Reread more specific information */
return (-1);
}
}
return (netfd);
}