Page 294 - DCAP403_Operating System
P. 294

Unit 13: Case Study: Linux




          of protocol operations. This is a set of routines, each of which performs a a particular operation   Notes

          specific to that address family. The registered protocol operations are kept in the pops vector, a
          vector of pointers to proto_ops data structures.
          The proto_ops data structure consists of the address family type and a set of pointers to socket

          operation routines specific to a particular address family. The pops vector is indexed by the


          address family identifier, for example the Internet address family identifier (AF_INET is 2).
                               Figure 13.14: Linux BSD Socket Data Structures
              files_struct
              count
              close_on_exec
              open_fs
              fd[0]              file
              fd[1]              f_mode
                                 f_pcs
                                 f_flags
              fd[255]            f_count
                                 f_ownet
                                                                    BSD Socket
                                 f_op                               File Operations
                                 f_inode                               1seek
                                                                       read
                                 f_version
                                                                       write
                                                                       select
                                                    inode
                                                                       ioctl
                                                                       fasync
                                                   socket
                                                  type
                                                           SOCK_STREAM
                                                  ops                Address Family
                                                  data               socket operations



                                                    sock
                                                  type       SOCK_STREAM
                                                  protocol
                                                  socket








          13.9.4  The INET Socket Layer

          The INET socket layer supports the internet address family which contains the TCP/IP protocols.
          As discussed above, these protocols are layered, one protocol using the services of another.
          Linux’s TCP/IP code and data structures refl ect this layering. Its interface with the BSD socket
          layer is through the set of Internet address family socket operations which it registers with the
          BSD socket layer during network initialization. These are kept in the pops vector along with
          the other registered address families. The BSD socket layer calls the INET layer socket support
          routines from the registered INET proto_ops data structure to perform work for it. For example
          a BSD socket create request that gives the address family as INET will use the underlying INET
          socket create function. The BSD socket layer passes the socket data structure representing the
          BSD socket to the INET layer in each of these operations. Rather than clutter the BSD socket wiht
          TCP/IP specific information, the INET socket layer uses its own data structure, the sock which it



                                           LOVELY PROFESSIONAL UNIVERSITY                                   287
   289   290   291   292   293   294   295   296   297   298   299