HP (Hewlett-Packard) B2355-90138 Network Card User Manual


 
Chapter 2 35
LLA and DLPI Example Programs
LLA Example Program
/* Copy the address to ret_addr */
memcpy(ret_addr, (caddr_t)ctrl_buf.value.s, 6);
}
/****************************************************************************
Set the destination MAC and SAP address.
****************************************************************************/
void
set_dst_address(fd, dest_addr, dsap, length)
int fd; /* file descriptor */
caddr_t dest_addr;/* return local address here */
int dsap;/* destination sap */
int length;/* destination sap length */
{
ctrl_buf.reqtype = LOG_DEST_ADDR;
ctrl_buf.vtype = 6;
memcpy((caddr_t)ctrl_buf.value.s, dest_addr, 6);
/* send the LOG_DEST_ADDR request. LLA will return success or
failure when the ioctl completes, so there is no need to
wait for an acknowledgement.
*/
put_ctrl(fd, NETCTRL);
/* Only log sap addresses, SNAP addresses do not need to
be logged twice.
*/
if (length == INTEGERTYPE) {
ctrl_buf.reqtype = LOG_DSAP;
ctrl_buf.vtype = INTEGERTYPE;
ctrl_buf.value.i = dsap;
put_ctrl(fd, NETCTRL);
}
}
/****************************************************************************
bind to a SNAP sap.
****************************************************************************/
void
bind_snap(fd, snapsap)
int fd;
u_char *snapsap;
{
/* Fill in SNAP req */
ctrl_buf.reqtype = LOG_SNAP_TYPE;
ctrl_buf.vtype = 5;
memcpy((caddr_t)ctrl_buf.value.s, snapsap, 5);
/* send the SNAP request. */
put_ctrl(fd, NETCTRL);
}