Details of TCP/IP 2: Implementation notes -- plug-in Options

Source: Internet
Author: User
Lists the functions that are called by the plug-in option system.


1. The setsockopt system call displays the options concentrated at the sol_socket level.
The following is a prototype of setsockopt system call:
The function copies data from the process to the mbuf allocated by the kernel, and then calls the sosetopt function.
1.1.sosetopt: The sosetopt function processes all plug-in options and transmits other options to the pr_ctloutput function of the Protocol associated with the plug-in (using the prco_setopt option ).
2. The getsockopt system calls getsockopt to return the plug-in and protocol options of the process request. The system call declaration is as follows:

The function copies the cached options to the kernel and calls sogetopt to obtain the value of the options. Copy the data returned by sogetopt to the cache provided by the process. You may need to modify the cache length.
2.1.sogetopt functions are the same as sosetopt functions. sogetopt functions process all plug-in options and pass other options to the pr_ctloutput function of the Protocol associated with the plug-in (using the prco_getopt option ).
3. fcntl and IOCTL system calls are not intentionally performed due to historical reasons. Several features of the plug-in API can be accessed either through IOCTL or through fcntl. The functions described in this section are displayed.
The characteristics of these two system calls related to the plug-in are summarized. We also list some traditional constants because they appear in the code. Considering the compatibility with POSIX, you can use o_nonblock to replace fnonblock and o_async to replace fasync.


In the 3.1.fcntl function fcntl, the interface-related processing is as follows: f_getfl returns the descriptor-related current file status flag. F_setfl sets the status flag. Call fo_ioctl to pass the new settings of fnonblock and fasync to the corresponding plug-in. The new settings of the plug-in are passed through the soo_ioctl function. F_getown returns the identifier of the process or process group associated with the plug-in. For non-intercept descriptors, tiocgpgrp is passed to the corresponding fo_ioctl function. F_setown assigns a new value to so_pgid.
3.2.ioctl function we will skip the ioctl System Call and start from soo_ioctl. The soo_ioctl function will send the routing command to rtioctl, and the interface command will be sent to ifioctl, any other command is sent to the pr_usrreq function of the underlying protocol.

Details of TCP/IP 2: Implementation notes -- plug-in Options

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.