title: Understanding XDR specification to create a *.x file
body: <p>I have been looking through several websites on the Internet and actually wanted to know how do we write specification in a <strong><em>.x</strong> file to generate equivalent functions in <strong></em>.c</strong> file for RPC. Every site I visited suggested to use following kind of specification in <strong>*.x</strong> file:</p>
  
  <pre><code>program ADD_PROG { 
      version ADD_VERS { 
          int ADD(intpair) = 1; 
      } = 1; 
  } = 0x23451111;
  </code></pre>
  
  <p>So, to understand practically, I obtained <a href="https://github.com/fastly/ganglia/blob/master/lib/gm_protocol.x" rel="nofollow">gm_protocol.x</a> from an open-source project known as ganglia and generated equivalent C source code (<a href="https://github.com/simplegeo/ganglia/blob/master/lib/gm_protocol_xdr.c" rel="nofollow">gm_protocol_xdr.c</a>) and C header file (<a href="https://github.com/simplegeo/ganglia/blob/master/lib/gm_protocol.h" rel="nofollow">gm_protocol.h</a>) using rpcgen. </p>
  
  <pre><code>[rohit@ganglia-server rpc]$ rpcgen -C gm_protocol.x 
  [rohit@ganglia-server rpc]$ 
  [rohit@ganglia-server rpc]$ ll
  total 24
  -rw-rw-r-- 1 rohit rohit 5786 Oct 28 17:52 gm_protocol.h
  -rw-rw-r-- 1 rohit rohit 3485 Oct 28 15:04 gm_protocol.x
  -rw-rw-r-- 1 rohit rohit 8213 Oct 28 17:52 gm_protocol_xdr.c
  </code></pre>
  
  <p>To my surprise, from what I have learned and understood, gm_protocol.x doesn't contain any such RPC specifications shown as code above but still it can generate too many functions in the file gm_protocol_xdr.c. </p>
  
  <p>It is pretty much sure that I am not able to understand the XDR specifications because either I have consulted wrong sources or they are outdated. I could not find any tutorial which could explain the way to generate functions (Although I have found specifications to generate struct, enum, union, etc).</p>
  
  <p>Please help to learn these specifications.</p>