What are the .x files in /usr/include?

They are descriptions of SunRPC-based protocols (RPC standing for Remote Procedure Call). Each file typically describes data structures which are used by these RPCs, and programs which implement them; for example, yppasswd.x describes the Yellow Pages password update protocol and is relatively easy to understand:

program YPPASSWDPROG {
        version YPPASSWDVERS {
                /*
                 * Update my passwd entry
                 */
                int
                YPPASSWDPROC_UPDATE(yppasswd) = 1;
        } = 1;
} = 100009;


struct passwd {
        string pw_name<>;       /* username */
        string pw_passwd<>;     /* encrypted password */
        int pw_uid;             /* user id */
        int pw_gid;             /* group id */
        string pw_gecos<>;      /* in real life name */
        string pw_dir<>;        /* home directory */
        string pw_shell<>;      /* default shell */
};

struct yppasswd {
        string oldpass<>;       /* unencrypted old password */
        passwd newpw;           /* new passwd entry */
};

This declares an RPC YP password update procedure, which takes a yppasswd structure as argument and returns an int. The file also describes the yppasswd structure itself, along with the passwd structure which it uses.

These files are generally used with rpcgen which will generate stub server and client code, which can then be used to implement an RPC server for the protocol and/or an RPC client. It can even generate example client and server code.

As indicated by Kusalananda, the rpcgen(1) manpage has more information.


Snippet from the rpcgen manual on a Linux system:

   rpcgen is a tool that generates C code to implement an RPC protocol.  The
   input to rpcgen is a language similar to C known as RPC Language  (Remote
   Procedure Call Language).

   rpcgen  is normally used as in the first synopsis where it takes an input
   file and generates up to four output  files.   If  the  infile  is  named
   proto.x, then rpcgen will generate a header file in proto.h, XDR routines
   in proto_xdr.c, server-side stubs in proto_svc.c, and  client-side  stubs
   in  proto_clnt.c.

See man rpcgen.