SOURCE_FILE
  EXTERN_BLOCK
    ABI
      EXTERN_KW "extern"
    WHITESPACE " "
    EXTERN_ITEM_LIST
      L_CURLY "{"
      WHITESPACE "\n    "
      FN
        VISIBILITY
          PUB_KW "pub"
        WHITESPACE " "
        FN_KW "fn"
        WHITESPACE " "
        NAME
          IDENT "socket"
        PARAM_LIST
          L_PAREN "("
          PARAM
            IDENT_PAT
              NAME
                IDENT "domain"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  COLON2 "::"
                  NAME_REF
                    IDENT "c_int"
          COMMA ","
          WHITESPACE " "
          PARAM
            IDENT_PAT
              NAME
                IDENT "ty"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  COLON2 "::"
                  NAME_REF
                    IDENT "c_int"
          COMMA ","
          WHITESPACE " "
          PARAM
            IDENT_PAT
              NAME
                IDENT "protocol"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  COLON2 "::"
                  NAME_REF
                    IDENT "c_int"
          R_PAREN ")"
        WHITESPACE " "
        RET_TYPE
          THIN_ARROW "->"
          WHITESPACE " "
          PATH_TYPE
            PATH
              PATH_SEGMENT
                COLON2 "::"
                NAME_REF
                  IDENT "c_int"
        SEMICOLON ";"
      WHITESPACE "\n    "
      FN
        VISIBILITY
          PUB_KW "pub"
        WHITESPACE " "
        FN_KW "fn"
        WHITESPACE " "
        NAME
          IDENT "bind"
        PARAM_LIST
          L_PAREN "("
          PARAM
            IDENT_PAT
              NAME
                IDENT "fd"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  COLON2 "::"
                  NAME_REF
                    IDENT "c_int"
          COMMA ","
          WHITESPACE " "
          PARAM
            IDENT_PAT
              NAME
                IDENT "addr"
            COLON ":"
            WHITESPACE " "
            PTR_TYPE
              STAR "*"
              CONST_KW "const"
              WHITESPACE " "
              PATH_TYPE
                PATH
                  PATH_SEGMENT
                    NAME_REF
                      IDENT "sockaddr"
          COMMA ","
          WHITESPACE " "
          PARAM
            IDENT_PAT
              NAME
                IDENT "len"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  NAME_REF
                    IDENT "socklen_t"
          R_PAREN ")"
        WHITESPACE " "
        RET_TYPE
          THIN_ARROW "->"
          WHITESPACE " "
          PATH_TYPE
            PATH
              PATH_SEGMENT
                COLON2 "::"
                NAME_REF
                  IDENT "c_int"
        SEMICOLON ";"
      WHITESPACE "\n    "
      FN
        VISIBILITY
          PUB_KW "pub"
        WHITESPACE " "
        FN_KW "fn"
        WHITESPACE " "
        NAME
          IDENT "connect"
        PARAM_LIST
          L_PAREN "("
          PARAM
            IDENT_PAT
              NAME
                IDENT "socket"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  COLON2 "::"
                  NAME_REF
                    IDENT "c_int"
          COMMA ","
          WHITESPACE " "
          PARAM
            IDENT_PAT
              NAME
                IDENT "address"
            COLON ":"
            WHITESPACE " "
            PTR_TYPE
              STAR "*"
              CONST_KW "const"
              WHITESPACE " "
              PATH_TYPE
                PATH
                  PATH_SEGMENT
                    NAME_REF
                      IDENT "sockaddr"
          COMMA ","
          WHITESPACE "\n                   "
          PARAM
            IDENT_PAT
              NAME
                IDENT "len"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  NAME_REF
                    IDENT "socklen_t"
          R_PAREN ")"
        WHITESPACE " "
        RET_TYPE
          THIN_ARROW "->"
          WHITESPACE " "
          PATH_TYPE
            PATH
              PATH_SEGMENT
                COLON2 "::"
                NAME_REF
                  IDENT "c_int"
        SEMICOLON ";"
      WHITESPACE "\n    "
      FN
        VISIBILITY
          PUB_KW "pub"
        WHITESPACE " "
        FN_KW "fn"
        WHITESPACE " "
        NAME
          IDENT "listen"
        PARAM_LIST
          L_PAREN "("
          PARAM
            IDENT_PAT
              NAME
                IDENT "socket"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  COLON2 "::"
                  NAME_REF
                    IDENT "c_int"
          COMMA ","
          WHITESPACE " "
          PARAM
            IDENT_PAT
              NAME
                IDENT "backlog"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  COLON2 "::"
                  NAME_REF
                    IDENT "c_int"
          R_PAREN ")"
        WHITESPACE " "
        RET_TYPE
          THIN_ARROW "->"
          WHITESPACE " "
          PATH_TYPE
            PATH
              PATH_SEGMENT
                COLON2 "::"
                NAME_REF
                  IDENT "c_int"
        SEMICOLON ";"
      WHITESPACE "\n    "
      FN
        VISIBILITY
          PUB_KW "pub"
        WHITESPACE " "
        FN_KW "fn"
        WHITESPACE " "
        NAME
          IDENT "getsockname"
        PARAM_LIST
          L_PAREN "("
          PARAM
            IDENT_PAT
              NAME
                IDENT "socket"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  COLON2 "::"
                  NAME_REF
                    IDENT "c_int"
          COMMA ","
          WHITESPACE " "
          PARAM
            IDENT_PAT
              NAME
                IDENT "address"
            COLON ":"
            WHITESPACE " "
            PTR_TYPE
              STAR "*"
              MUT_KW "mut"
              WHITESPACE " "
              PATH_TYPE
                PATH
                  PATH_SEGMENT
                    NAME_REF
                      IDENT "sockaddr"
          COMMA ","
          WHITESPACE "\n                       "
          PARAM
            IDENT_PAT
              NAME
                IDENT "address_len"
            COLON ":"
            WHITESPACE " "
            PTR_TYPE
              STAR "*"
              MUT_KW "mut"
              WHITESPACE " "
              PATH_TYPE
                PATH
                  PATH_SEGMENT
                    NAME_REF
                      IDENT "socklen_t"
          R_PAREN ")"
        WHITESPACE " "
        RET_TYPE
          THIN_ARROW "->"
          WHITESPACE " "
          PATH_TYPE
            PATH
              PATH_SEGMENT
                COLON2 "::"
                NAME_REF
                  IDENT "c_int"
        SEMICOLON ";"
      WHITESPACE "\n    "
      FN
        VISIBILITY
          PUB_KW "pub"
        WHITESPACE " "
        FN_KW "fn"
        WHITESPACE " "
        NAME
          IDENT "getsockopt"
        PARAM_LIST
          L_PAREN "("
          PARAM
            IDENT_PAT
              NAME
                IDENT "sockfd"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  COLON2 "::"
                  NAME_REF
                    IDENT "c_int"
          COMMA ","
          WHITESPACE "\n                      "
          PARAM
            IDENT_PAT
              NAME
                IDENT "level"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  COLON2 "::"
                  NAME_REF
                    IDENT "c_int"
          COMMA ","
          WHITESPACE "\n                      "
          PARAM
            IDENT_PAT
              NAME
                IDENT "optname"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  COLON2 "::"
                  NAME_REF
                    IDENT "c_int"
          COMMA ","
          WHITESPACE "\n                      "
          PARAM
            IDENT_PAT
              NAME
                IDENT "optval"
            COLON ":"
            WHITESPACE " "
            PTR_TYPE
              STAR "*"
              MUT_KW "mut"
              WHITESPACE " "
              PATH_TYPE
                PATH
                  PATH_SEGMENT
                    COLON2 "::"
                    NAME_REF
                      IDENT "c_void"
          COMMA ","
          WHITESPACE "\n                      "
          PARAM
            IDENT_PAT
              NAME
                IDENT "optlen"
            COLON ":"
            WHITESPACE " "
            PTR_TYPE
              STAR "*"
              MUT_KW "mut"
              WHITESPACE " "
              PATH_TYPE
                PATH
                  PATH_SEGMENT
                    COLON2 "::"
                    NAME_REF
                      IDENT "socklen_t"
          R_PAREN ")"
        WHITESPACE " "
        RET_TYPE
          THIN_ARROW "->"
          WHITESPACE " "
          PATH_TYPE
            PATH
              PATH_SEGMENT
                COLON2 "::"
                NAME_REF
                  IDENT "c_int"
        SEMICOLON ";"
      WHITESPACE "\n    "
      FN
        VISIBILITY
          PUB_KW "pub"
        WHITESPACE " "
        FN_KW "fn"
        WHITESPACE " "
        NAME
          IDENT "setsockopt"
        PARAM_LIST
          L_PAREN "("
          PARAM
            IDENT_PAT
              NAME
                IDENT "socket"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  COLON2 "::"
                  NAME_REF
                    IDENT "c_int"
          COMMA ","
          WHITESPACE " "
          PARAM
            IDENT_PAT
              NAME
                IDENT "level"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  COLON2 "::"
                  NAME_REF
                    IDENT "c_int"
          COMMA ","
          WHITESPACE " "
          PARAM
            IDENT_PAT
              NAME
                IDENT "name"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  COLON2 "::"
                  NAME_REF
                    IDENT "c_int"
          COMMA ","
          WHITESPACE "\n                      "
          PARAM
            IDENT_PAT
              NAME
                IDENT "value"
            COLON ":"
            WHITESPACE " "
            PTR_TYPE
              STAR "*"
              CONST_KW "const"
              WHITESPACE " "
              PATH_TYPE
                PATH
                  PATH_SEGMENT
                    COLON2 "::"
                    NAME_REF
                      IDENT "c_void"
          COMMA ","
          WHITESPACE "\n                      "
          PARAM
            IDENT_PAT
              NAME
                IDENT "option_len"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  NAME_REF
                    IDENT "socklen_t"
          R_PAREN ")"
        WHITESPACE " "
        RET_TYPE
          THIN_ARROW "->"
          WHITESPACE " "
          PATH_TYPE
            PATH
              PATH_SEGMENT
                COLON2 "::"
                NAME_REF
                  IDENT "c_int"
        SEMICOLON ";"
      WHITESPACE "\n    "
      FN
        VISIBILITY
          PUB_KW "pub"
        WHITESPACE " "
        FN_KW "fn"
        WHITESPACE " "
        NAME
          IDENT "getpeername"
        PARAM_LIST
          L_PAREN "("
          PARAM
            IDENT_PAT
              NAME
                IDENT "socket"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  COLON2 "::"
                  NAME_REF
                    IDENT "c_int"
          COMMA ","
          WHITESPACE " "
          PARAM
            IDENT_PAT
              NAME
                IDENT "address"
            COLON ":"
            WHITESPACE " "
            PTR_TYPE
              STAR "*"
              MUT_KW "mut"
              WHITESPACE " "
              PATH_TYPE
                PATH
                  PATH_SEGMENT
                    NAME_REF
                      IDENT "sockaddr"
          COMMA ","
          WHITESPACE "\n                       "
          PARAM
            IDENT_PAT
              NAME
                IDENT "address_len"
            COLON ":"
            WHITESPACE " "
            PTR_TYPE
              STAR "*"
              MUT_KW "mut"
              WHITESPACE " "
              PATH_TYPE
                PATH
                  PATH_SEGMENT
                    NAME_REF
                      IDENT "socklen_t"
          R_PAREN ")"
        WHITESPACE " "
        RET_TYPE
          THIN_ARROW "->"
          WHITESPACE " "
          PATH_TYPE
            PATH
              PATH_SEGMENT
                COLON2 "::"
                NAME_REF
                  IDENT "c_int"
        SEMICOLON ";"
      WHITESPACE "\n    "
      FN
        VISIBILITY
          PUB_KW "pub"
        WHITESPACE " "
        FN_KW "fn"
        WHITESPACE " "
        NAME
          IDENT "sendto"
        PARAM_LIST
          L_PAREN "("
          PARAM
            IDENT_PAT
              NAME
                IDENT "socket"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  COLON2 "::"
                  NAME_REF
                    IDENT "c_int"
          COMMA ","
          WHITESPACE " "
          PARAM
            IDENT_PAT
              NAME
                IDENT "buf"
            COLON ":"
            WHITESPACE " "
            PTR_TYPE
              STAR "*"
              CONST_KW "const"
              WHITESPACE " "
              PATH_TYPE
                PATH
                  PATH_SEGMENT
                    COLON2 "::"
                    NAME_REF
                      IDENT "c_void"
          COMMA ","
          WHITESPACE " "
          PARAM
            IDENT_PAT
              NAME
                IDENT "len"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  COLON2 "::"
                  NAME_REF
                    IDENT "size_t"
          COMMA ","
          WHITESPACE "\n                  "
          PARAM
            IDENT_PAT
              NAME
                IDENT "flags"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  COLON2 "::"
                  NAME_REF
                    IDENT "c_int"
          COMMA ","
          WHITESPACE " "
          PARAM
            IDENT_PAT
              NAME
                IDENT "addr"
            COLON ":"
            WHITESPACE " "
            PTR_TYPE
              STAR "*"
              CONST_KW "const"
              WHITESPACE " "
              PATH_TYPE
                PATH
                  PATH_SEGMENT
                    NAME_REF
                      IDENT "sockaddr"
          COMMA ","
          WHITESPACE "\n                  "
          PARAM
            IDENT_PAT
              NAME
                IDENT "addrlen"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  NAME_REF
                    IDENT "socklen_t"
          R_PAREN ")"
        WHITESPACE " "
        RET_TYPE
          THIN_ARROW "->"
          WHITESPACE " "
          PATH_TYPE
            PATH
              PATH_SEGMENT
                COLON2 "::"
                NAME_REF
                  IDENT "ssize_t"
        SEMICOLON ";"
      WHITESPACE "\n    "
      FN
        VISIBILITY
          PUB_KW "pub"
        WHITESPACE " "
        FN_KW "fn"
        WHITESPACE " "
        NAME
          IDENT "send"
        PARAM_LIST
          L_PAREN "("
          PARAM
            IDENT_PAT
              NAME
                IDENT "socket"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  COLON2 "::"
                  NAME_REF
                    IDENT "c_int"
          COMMA ","
          WHITESPACE " "
          PARAM
            IDENT_PAT
              NAME
                IDENT "buf"
            COLON ":"
            WHITESPACE " "
            PTR_TYPE
              STAR "*"
              CONST_KW "const"
              WHITESPACE " "
              PATH_TYPE
                PATH
                  PATH_SEGMENT
                    COLON2 "::"
                    NAME_REF
                      IDENT "c_void"
          COMMA ","
          WHITESPACE " "
          PARAM
            IDENT_PAT
              NAME
                IDENT "len"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  COLON2 "::"
                  NAME_REF
                    IDENT "size_t"
          COMMA ","
          WHITESPACE "\n                "
          PARAM
            IDENT_PAT
              NAME
                IDENT "flags"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  COLON2 "::"
                  NAME_REF
                    IDENT "c_int"
          R_PAREN ")"
        WHITESPACE " "
        RET_TYPE
          THIN_ARROW "->"
          WHITESPACE " "
          PATH_TYPE
            PATH
              PATH_SEGMENT
                COLON2 "::"
                NAME_REF
                  IDENT "ssize_t"
        SEMICOLON ";"
      WHITESPACE "\n    "
      FN
        VISIBILITY
          PUB_KW "pub"
        WHITESPACE " "
        FN_KW "fn"
        WHITESPACE " "
        NAME
          IDENT "recvfrom"
        PARAM_LIST
          L_PAREN "("
          PARAM
            IDENT_PAT
              NAME
                IDENT "socket"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  COLON2 "::"
                  NAME_REF
                    IDENT "c_int"
          COMMA ","
          WHITESPACE " "
          PARAM
            IDENT_PAT
              NAME
                IDENT "buf"
            COLON ":"
            WHITESPACE " "
            PTR_TYPE
              STAR "*"
              MUT_KW "mut"
              WHITESPACE " "
              PATH_TYPE
                PATH
                  PATH_SEGMENT
                    COLON2 "::"
                    NAME_REF
                      IDENT "c_void"
          COMMA ","
          WHITESPACE " "
          PARAM
            IDENT_PAT
              NAME
                IDENT "len"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  COLON2 "::"
                  NAME_REF
                    IDENT "size_t"
          COMMA ","
          WHITESPACE "\n                    "
          PARAM
            IDENT_PAT
              NAME
                IDENT "flags"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  COLON2 "::"
                  NAME_REF
                    IDENT "c_int"
          COMMA ","
          WHITESPACE " "
          PARAM
            IDENT_PAT
              NAME
                IDENT "addr"
            COLON ":"
            WHITESPACE " "
            PTR_TYPE
              STAR "*"
              MUT_KW "mut"
              WHITESPACE " "
              PATH_TYPE
                PATH
                  PATH_SEGMENT
                    COLON2 "::"
                    NAME_REF
                      IDENT "sockaddr"
          COMMA ","
          WHITESPACE "\n                    "
          PARAM
            IDENT_PAT
              NAME
                IDENT "addrlen"
            COLON ":"
            WHITESPACE " "
            PTR_TYPE
              STAR "*"
              MUT_KW "mut"
              WHITESPACE " "
              PATH_TYPE
                PATH
                  PATH_SEGMENT
                    COLON2 "::"
                    NAME_REF
                      IDENT "socklen_t"
          R_PAREN ")"
        WHITESPACE " "
        RET_TYPE
          THIN_ARROW "->"
          WHITESPACE " "
          PATH_TYPE
            PATH
              PATH_SEGMENT
                COLON2 "::"
                NAME_REF
                  IDENT "ssize_t"
        SEMICOLON ";"
      WHITESPACE "\n    "
      FN
        VISIBILITY
          PUB_KW "pub"
        WHITESPACE " "
        FN_KW "fn"
        WHITESPACE " "
        NAME
          IDENT "recv"
        PARAM_LIST
          L_PAREN "("
          PARAM
            IDENT_PAT
              NAME
                IDENT "socket"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  COLON2 "::"
                  NAME_REF
                    IDENT "c_int"
          COMMA ","
          WHITESPACE " "
          PARAM
            IDENT_PAT
              NAME
                IDENT "buf"
            COLON ":"
            WHITESPACE " "
            PTR_TYPE
              STAR "*"
              MUT_KW "mut"
              WHITESPACE " "
              PATH_TYPE
                PATH
                  PATH_SEGMENT
                    COLON2 "::"
                    NAME_REF
                      IDENT "c_void"
          COMMA ","
          WHITESPACE " "
          PARAM
            IDENT_PAT
              NAME
                IDENT "len"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  COLON2 "::"
                  NAME_REF
                    IDENT "size_t"
          COMMA ","
          WHITESPACE "\n                "
          PARAM
            IDENT_PAT
              NAME
                IDENT "flags"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  COLON2 "::"
                  NAME_REF
                    IDENT "c_int"
          R_PAREN ")"
        WHITESPACE " "
        RET_TYPE
          THIN_ARROW "->"
          WHITESPACE " "
          PATH_TYPE
            PATH
              PATH_SEGMENT
                COLON2 "::"
                NAME_REF
                  IDENT "ssize_t"
        SEMICOLON ";"
      WHITESPACE "\n"
      R_CURLY "}"
  WHITESPACE "\n"
