arp_getdata(fd, offset, count, for_ioctl) accomplishes several different tasks, depending on the state of the arp port:
APS_ARPPROTO (configuration state):
If count, arp_getdata()'s third parameter, is non-zero, arp_getdata() creates a nwio_eth_opt struct and sets the appropriate flags and type for an ethernet file descriptor that services an arp port:
and then returns an accessor that contains the struct.
ARS_ARPMAIN (operational state):
If count, arp_getdata()'s third parameter, is non-zero, arp_getdata() creates an arp packet (an arp46_t struct) and returns the struct. eth_write() calls arp_getdata() to create an arp-request or arp_reply packet (the packets that build the arp table. The ip and ethernet address of the arp-reply or request is gotten from the ap_write_ipaddr and ap_write_ethaddr fields, respectively, of the arp port.