/* file descriptor */

LLA and DLPI Example Programs

LLA Example Program

/**************************************************************************** Close the file descriptor. This will automatically unbind the protocol.

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

void cleanup(fd)

int fd;

{

/* close */ close(fd);

}

/**************************************************************************** receive a data packet;

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

int

 

 

recv_data(fd)

 

 

int

fd;

/* file descriptor */

{

 

 

int

length;

 

length = get_pkt(fd);

if(length == 0)

{

printf(”error: did not receive any data part \n”); exit(1);

}

return(length);

}

/**************************************************************************** send a data packet; assumes data_area has already been filled in

and a destination address has already been logged.

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

void

 

 

send_data(fd, len)

 

int

fd;

/* file descriptor */

int

len;

/* length of the packet to send */

{

 

 

put_data(fd, len);

}

/**************************************************************************** print a string followed by a destination MAC and SAP address.

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

void

print_dest_addr(string, dest_addr, dest_addr_len)

char

*string;

/*

label */

u_char

*dest_addr;

/*

the destination address */

36

Chapter 2

Page 36
Image 36
HP B2355-90138 manual LLA Example Program