HP B2355-90138 manual LLA Example Program

Page 34

 

LLA and DLPI Example Programs

 

LLA Example Program

intfd;

/* file descriptor */

char *mac_name;

/* open the device file */

if((fd = open(”/dev/lan0”, O_RDWR)) == -1) { printf(”error: open failed, errno = %d\n”, errno); exit(1);

}

/* return the file descriptor for the LLA device to the caller */ return(fd);

}

/**************************************************************************** Bind to a sap. LLA does not automatically return the local MAC address and local sap information when binding a protocol value.

You must explicitly request the local MAC address via the LOCAL_ADDRESS control request.

****************************************************************************/

void

 

 

bind(fd, sap)

 

 

int

fd;

/* file descriptor */

int

sap;

/* 802.2 SAP to bind on */

{

 

 

ctrl_buf.reqtype = LOG_SSAP; ctrl_buf.vtype = INTEGERTYPE; ctrl_buf.value.i = sap;

/* send the LOG_SSAP 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);

}

/**************************************************************************** Get the local MAC address.

****************************************************************************/

void

 

 

get_local_address(fd, ret_addr)

 

int

fd;

/* file descriptor */

caddr_tret_addr;/* return local address here */

{

ctrl_buf.reqtype = LOCAL_ADDRESS;

/* send the LOCAL_ADDRESS request. LLA will return success or

failure when the ioctl completes, so there is no need to wait for an acknowledgement.

*/

put_ctrl(fd, NETSTAT);

34

Chapter 2

Image 34
Contents LLA to Dlpi Migration Guide Legal Notices Page Page Contents Contents Printing History Page Preface Page LLA to Dlpi Migration LLA to Dlpi Migration Device Files Ioctl Requests LLA ioctl req type Dlpi PrimitiveLogreadtimeout Transmitting Data Receiving Data Receiving Data LLA and Dlpi Example LLA and Dlpi Example Programs Dlpi Example Program Snap SAPStruct strbuf databuf = Dlpi Example Program Dlpi Example Program Dlpi Example Program Dlpi Example Program Dlpi Example Program Dlpi Example Program Dlpi Example Program Dlpi Example Program Dlpi Example Program LLA Example Program LLA Example Program LLA Example Program LLA Example Program LLA Example Program LLA Example Program LLA Example Program LLA Example Program LLA Example Program Index