Title: udp_open()

udp_open(port, srfd, get_getuserdata, put_userdata, put_pkt), called from sr_open(), finds the first unused element in udp_fd_table[], configures this udp file descriptor with the arguments passed in, and returns the index of the (newly configured) element within udp_fd_table[].

The parameters are explained below:

When a process opens one of the udp devices (e.g., /dev/udp), sr_open() claims an unused element in sr_fd_table[] and copies the element of sr_fd_table[] that corresponds to the device to this unused element. This element number is then passed in as the second argument (srfd). Later, when the process wishes to read or write or perform ioctl on this open file descriptor, it includes this sr file descriptor in the message that it sends the file system.

For the following example inet.conf file:

eth0 DP8390 0 { default; };

there are 2 ports. Port 0 corresponds to the ethernet device and port 1 corresponds to the psip port.

get_userdata is a pointer to the function that gets the data from the process. This function will always be sr_get_userdata().

sr_put_userdata is a pointer to the function that copies data into the user process. This function will always be sr_put_userdata().

The put_pkt parameter is not used in this function.