{
    "content": [
        {
            "type": "text",
            "text": "# rpcgen (man)\n\n## NAME\n\nrrppccggeenn - an RPC protocol compiler\n\n## SYNOPSIS\n\nrrppccggeenn infile\nrrppccggeenn [[--DDname[[==value]]]] [[--TT]] [[--KK secs]] infile\nrrppccggeenn --cc||--hh||--ll||--mm||--MM||--tt [[--oo outfile ]] infile\nrrppccggeenn [[--II]] --ss nettype [[--oo outfile]] infile\nrrppccggeenn --nn netid [[--oo outfile]] infile\n\n## DESCRIPTION\n\nrrppccggeenn  is a tool that generates C code to implement an RPC protocol.  The input to rrppccggeenn is\na language similar to C known as RPC Language (Remote Procedure Call Language).\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **NOTES**\n- **EXAMPLE**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "rpcgen",
        "section": "",
        "mode": "man",
        "summary": "rrppccggeenn - an RPC protocol compiler",
        "synopsis": "rrppccggeenn infile\nrrppccggeenn [[--DDname[[==value]]]] [[--TT]] [[--KK secs]] infile\nrrppccggeenn --cc||--hh||--ll||--mm||--MM||--tt [[--oo outfile ]] infile\nrrppccggeenn [[--II]] --ss nettype [[--oo outfile]] infile\nrrppccggeenn --nn netid [[--oo outfile]] infile",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [
            "The following example:",
            "$$ rrppccggeenn --TT pprroott..xx",
            "generates the five files: pprroott..hh, pprroottccllnntt..cc, pprroottssvvcc..cc, pprroottxxddrr..cc and pprroottttbbll..ii.",
            "The following example sends the C data-definitions (header file) to the standard output.",
            "$$ rrppccggeenn --hh pprroott..xx",
            "To send the test version of the --DDTTEESSTT, server side stubs for all the transport belonging  to",
            "the class ddaattaaggrraammnn to standard output, use:",
            "$$ rrppccggeenn --ss ddaattaaggrraammnn --DDTTEESSTT pprroott..xx",
            "To create the server side stubs for the transport indicated by netid ttccpp, use:",
            "$$ rrppccggeenn --nn ttccpp --oo pprroottssvvcc..cc pprroott..xx"
        ],
        "see_also": [
            {
                "name": "cccc",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/cccc/1/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 145,
                "subsections": []
            },
            {
                "name": "NOTES",
                "lines": 11,
                "subsections": []
            },
            {
                "name": "EXAMPLE",
                "lines": 19,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "rrppccggeenn - an RPC protocol compiler\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "rrppccggeenn infile\nrrppccggeenn [[--DDname[[==value]]]] [[--TT]] [[--KK secs]] infile\nrrppccggeenn --cc||--hh||--ll||--mm||--MM||--tt [[--oo outfile ]] infile\nrrppccggeenn [[--II]] --ss nettype [[--oo outfile]] infile\nrrppccggeenn --nn netid [[--oo outfile]] infile\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "rrppccggeenn  is a tool that generates C code to implement an RPC protocol.  The input to rrppccggeenn is\na language similar to C known as RPC Language (Remote Procedure Call Language).\n\nrrppccggeenn is normally used as in the first synopsis where it takes an input file  and  generates\nup  to four output files.  If the infile is named pprroottoo..xx, then rrppccggeenn will generate a header\nfile in pprroottoo..hh, XDR routines in pprroottooxxddrr..cc, server-side stubs in pprroottoossvvcc..cc,  and  client-\nside stubs in pprroottooccllnntt..cc.  With the --TT option, it will also generate the RPC dispatch table\nin pprroottoottbbll..ii.  With the --SScc option, it will also generate  sample code which  would  illus‐\ntrate  how  to  use  the  remote procedures on the client side. This code would be created in\npprroottoocclliieenntt..cc.  With the --SSss option, it will also generate a sample server code which  would\nillustrate how to write the remote procedures. This code would be created in pprroottoosseerrvveerr..cc.\n\nThe server created can be started both by the port monitors (for example, iinneettdd or lliisstteenn) or\nby itself.  When it is started by a port monitor, it creates servers only for  the  transport\nfor  which  the file descriptor 00 was passed.  The name of the transport must be specified by\nsetting up the environmental variable PPMMTTRRAANNSSPPOORRTT.  When the server generated by  rrppccggeenn  is\nexecuted,  it  creates server handles for all the transports specified in NNEETTPPAATTHH environment\nvariable, or if it is unset, it creates server handles for all the  visible  transports  from\n//eettcc//nneettccoonnffiigg file.  Note: the transports are chosen at run time and not at compile time.\n\nWhen  built  for  a  port  monitor (rrppccggeenn --II), and that the server is self-started, it back‐\ngrounds itself by default.  A special define symbol RRPPCCSSVVCCFFGG can be used to run the  server\nprocess in foreground.\n\nThe  second synopsis provides special features which allow for the creation of more sophisti‐\ncated RPC servers.  These features include support for user provided ##ddeeffiinneess  and  RPC  dis‐\npatch tables.  The entries in the RPC dispatch table contain:\n•  pointers to the service routine corresponding to that procedure,\n•  a pointer to the input and output arguments\n•  the size of these routines\nA  server  can  use the dispatch table to check authorization and then to execute the service\nroutine; a client library may use it to deal with the details of storage management  and  XDR\ndata conversion.\n\nThe other three synopses shown above are used when one does not want to generate all the out‐\nput files, but only a particular one.  Some examples of their usage is described in the EXAM‐\nPLE  section  below.  When rrppccggeenn is executed with the --ss option, it creates servers for that\nparticular class of transports.  When executed with the --nn option, it creates  a  server  for\nthe  transport  specified  by netid.  If infile is not specified, rrppccggeenn accepts the standard\ninput.\n\nThe C preprocessor, cccc --EE [see cccc(1)], is run on the input file before it is actually  inter‐\npreted by rrppccggeenn.  For each type of output file, rrppccggeenn defines a special preprocessor symbol\nfor use by the rrppccggeenn programmer:\n\nRRPPCCHHDDRR     defined when compiling into header files\nRRPPCCXXDDRR     defined when compiling into XDR routines\nRRPPCCSSVVCC     defined when compiling into server-side stubs\nRRPPCCCCLLNNTT    defined when compiling into client-side stubs\nRRPPCCTTBBLL     defined when compiling into RPC dispatch tables\n\nAny line beginning with `%%' is passed directly into the output file, uninterpreted by rrppccggeenn.\n\nFor every data type referred to in infile, rrppccggeenn assumes that there exists  a  routine  with\nthe  string  xxddrr  prepended to the name of the data type.  If this routine does not exist in\nthe RPC/XDR library, it must be provided.  Providing an undefined data type allows customiza‐\ntion of XDR routines.\n\nThe following options are available:\n\n--aa     Generate all the files including sample code for client and server side.\n\n--bb     This  generates  code for the SunOS4.1 style of rpc. It is for backward compatibility.\nThis is the default.\n\n--55     This generates code for the SysVr4 style of rpc. It is used by the Transport  Indepen‐\ndent RPC that is in Svr4 systems.  By default rpcgen generates code for SunOS4.1 stype\nof rpc.\n\n--cc     Compile into XDR routines.\n\n--CC     Generate code in ANSI C. This option also generates code that could be  compiled  with\nthe C++ compiler.  This is the default.\n\n--kk     Generate code in K&R C.  The default is ANSI C.\n\n--DDname[[==value]]\nDefine a symbol name.  Equivalent to the ##ddeeffiinnee directive in the source.  If no value\nis given, value is defined as 11.  This option may be specified more than once.\n\n--hh     Compile into CC data-definitions (a header file).  --TT option can be used in conjunction\nto produce a header file which supports RPC dispatch tables.\n\n--II     Generate  a  service  that  can  be  started from inetd.  The default is to generate a\nstatic service that handles transports selected with --ss.  Using --II allows  starting  a\nservice by either method.\n\n--KK secs\nBy  default,  services created using rrppccggeenn wait 112200 seconds after servicing a request\nbefore exiting.  That interval can be changed using the --KK flag.  To create  a  server\nthat exits immediately upon servicing a request, --KK 00 can be used.  To create a server\nthat never exits, the appropriate argument is --KK --11.\n\nWhen monitoring for a server, some portmonitors, like lliisstteenn(1M), always spawn  a  new\nprocess  in  response to a service request.  If it is known that a server will be used\nwith such a monitor, the server should  exit  immediately  on  completion.   For  such\nservers, rrppccggeenn should be used with --KK --11.\n\n--ll     Compile into client-side stubs.\n\n--mm     Compile  into server-side stubs, but do not generate a “main” routine.  This option is\nuseful for doing callback-routines and for users who need to write  their  own  “main”\nroutine to do initialization.\n\n--MM     Generate  multithread-safe stubs for passing arguments and results between rpcgen-gen‐\nerated code and user written code.  This option is useful for users who  want  to  use\nthreads in their code.\n\n--nn netid\nCompile  into server-side stubs for the transport specified by netid.  There should be\nan entry for netid in the netconfig database.  This option may be specified more  than\nonce, so as to compile a server that serves multiple transports.\n\n--NN     Use  the  newstyle  of  rpcgen. This allows procedures to have multiple arguments.  It\nalso uses the style of parameter passing that closely resembles C. So, when passing an\nargument  to  a remote procedure you do not have to pass a pointer to the argument but\nthe argument itself. This behaviour is different from the oldstyle of rpcgen generated\ncode. The newstyle is not the default case because of backward compatibility.\n\n--oo outfile\nSpecify  the  name  of the output file.  If none is specified, standard output is used\n(--cc, --hh, --ll, --mm, --nn, --ss, --SScc, --SSmm, --SSss, and --tt modes only).\n\n--ss nettype\nCompile into server-side stubs for all the transports belonging to the class  nettype.\nThe  supported  classes  are nneettppaatthh, vviissiibbllee, cciirrccuuiittnn, cciirrccuuiittvv, ddaattaaggrraammnn, ddaattaa‐‐\nggrraammvv, ttccpp, and uuddpp [see rrppcc(3N) for the meanings  associated  with  these  classes].\nThis  option  may be specified more than once.  Note: the transports are chosen at run\ntime and not at compile time.\n\n--SScc    Generate sample code to show the use of remote procedure and how to bind to the server\nbefore calling the client side stubs generated by rpcgen.\n\n--SSmm    Generate a sample Makefile which can be used for compiling the application.\n\n--SSss    Generate skeleton code for the remote procedures on the server side. You would need to\nfill in the actual code for the remote procedures.\n\n--tt     Compile into RPC dispatch table.\n\n--TT     Generate the code to support RPC dispatch tables.\n\nThe options --cc, --hh, --ll, --mm, --ss and --tt are used exclusively to generate a particular  type  of\nfile, while the options --DD and --TT are global and can be used with the other options.\n",
                "subsections": []
            },
            "NOTES": {
                "content": "The RPC Language does not support nesting of structures.  As a work-around, structures can be\ndeclared at the top-level, and their name used inside other structures in  order  to  achieve\nthe same effect.\n\nName  clashes  can  occur when using program definitions, since the apparent scoping does not\nreally apply.  Most of these can be avoided by giving unique names  for  programs,  versions,\nprocedures and types.\n\nThe server code generated with --nn option refers to the transport indicated by netid and hence\nis very site specific.\n",
                "subsections": []
            },
            "EXAMPLE": {
                "content": "The following example:\n\n$$ rrppccggeenn --TT pprroott..xx\n\ngenerates the five files: pprroott..hh, pprroottccllnntt..cc, pprroottssvvcc..cc, pprroottxxddrr..cc and pprroottttbbll..ii.\n\nThe following example sends the C data-definitions (header file) to the standard output.\n\n$$ rrppccggeenn --hh pprroott..xx\n\nTo send the test version of the --DDTTEESSTT, server side stubs for all the transport belonging  to\nthe class ddaattaaggrraammnn to standard output, use:\n\n$$ rrppccggeenn --ss ddaattaaggrraammnn --DDTTEESSTT pprroott..xx\n\nTo create the server side stubs for the transport indicated by netid ttccpp, use:\n\n$$ rrppccggeenn --nn ttccpp --oo pprroottssvvcc..cc pprroott..xx\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "cccc(1).\n\n\n\n0a",
                "subsections": []
            }
        }
    }
}