summaryrefslogtreecommitdiff
path: root/rpc++
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1996-10-21 21:41:34 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1996-10-21 21:41:34 +0000
commita5fdebc5f6375078ec1763850a4ca23ec7fe6458 (patch)
treebcf0a25c3d45a209a6e3ac37b233a4812f29c732 /rpc++
downloadATCD-a5fdebc5f6375078ec1763850a4ca23ec7fe6458.tar.gz
Initial revision
Diffstat (limited to 'rpc++')
-rw-r--r--rpc++/.dependencies131
-rw-r--r--rpc++/COPYING481
-rw-r--r--rpc++/Makefile55
-rw-r--r--rpc++/Proj.make68
-rw-r--r--rpc++/README18
-rw-r--r--rpc++/README.ORIG9
-rw-r--r--rpc++/StdHdrs/Makefile13
-rw-r--r--rpc++/StdHdrs/README3
-rw-r--r--rpc++/StdHdrs/rpc/auth.h171
-rw-r--r--rpc++/StdHdrs/rpc/c_types.h79
-rw-r--r--rpc++/StdHdrs/rpc/clnt.h347
-rw-r--r--rpc++/StdHdrs/rpc/pmap_clnt.h82
-rw-r--r--rpc++/StdHdrs/rpc/svc.h286
-rw-r--r--rpc++/StdHdrs/rpc/xdr.h275
-rw-r--r--rpc++/callback.cc38
-rw-r--r--rpc++/example/Makefile40
-rw-r--r--rpc++/example/calcsvc.cc30
-rw-r--r--rpc++/example/calcsvc.h34
-rw-r--r--rpc++/example/client.cc64
-rw-r--r--rpc++/example/server.cc112
-rw-r--r--rpc++/gcc-2.2.fix252
-rw-r--r--rpc++/request.cc165
-rw-r--r--rpc++/rpc++.cp13
-rw-r--r--rpc++/rpc++.fn63
-rw-r--r--rpc++/rpc++.ky0
-rw-r--r--rpc++/rpc++.pg0
-rw-r--r--rpc++/rpc++.texi1519
-rw-r--r--rpc++/rpc++.toc23
-rw-r--r--rpc++/rpc++.tp7
-rw-r--r--rpc++/rpc++.vr13
-rw-r--r--rpc++/rpc++/callback.h533
-rw-r--r--rpc++/rpc++/request.h121
-rw-r--r--rpc++/rpc++/service.h132
-rw-r--r--rpc++/rpc++/stub.h145
-rw-r--r--rpc++/rpc++/xdr++.h98
-rw-r--r--rpc++/service.cc316
-rw-r--r--rpc++/stub.cc207
-rw-r--r--rpc++/version.h4
-rw-r--r--rpc++/xdr++.cc75
39 files changed, 6022 insertions, 0 deletions
diff --git a/rpc++/.dependencies b/rpc++/.dependencies
new file mode 100644
index 00000000000..9afb79a0c0b
--- /dev/null
+++ b/rpc++/.dependencies
@@ -0,0 +1,131 @@
+xdr++.o: xdr++.cc rpc++/xdr++.h /usr/include/rpc/rpc.h \
+ /usr/include/rpc/types.h \
+ /pkg/gnu/lib/gcc-lib/sparc-sun-solaris2.3/2.6.0/include/sys/types.h \
+ /usr/include/sys/feature_tests.h /usr/include/sys/machtypes.h \
+ /usr/include/sys/select.h /usr/include/sys/time.h \
+ /pkg/gnu/lib/gcc-lib/sparc-sun-solaris2.3/2.6.0/include/time.h \
+ /usr/include/sys/siginfo.h /usr/include/sys/machsig.h \
+ /usr/include/tiuser.h /usr/include/sys/tiuser.h /usr/include/fcntl.h \
+ /usr/include/sys/fcntl.h /usr/include/memory.h /usr/include/rpc/xdr.h \
+ /pkg/gnu/lib/gcc-lib/sparc-sun-solaris2.3/2.6.0/include/sys/byteorder.h \
+ /pkg/gnu/lib/gcc-lib/sparc-sun-solaris2.3/2.6.0/include/stdio.h \
+ /pkg/gnu/lib/gcc-lib/sparc-sun-solaris2.3/2.6.0/include/rpc/auth.h \
+ /usr/include/sys/cred.h /usr/include/sys/t_lock.h \
+ /usr/include/sys/machlock.h /usr/include/sys/dki_lkinfo.h \
+ /usr/include/sys/dl.h /usr/include/sys/sleepq.h \
+ /usr/include/sys/turnstile.h \
+ /pkg/gnu/lib/gcc-lib/sparc-sun-solaris2.3/2.6.0/include/sys/param.h \
+ /usr/include/sys/unistd.h /usr/include/sys/pirec.h \
+ /usr/include/sys/mutex.h /usr/include/rpc/clnt.h \
+ /usr/include/rpc/rpc_com.h /usr/include/sys/netconfig.h \
+ /usr/include/rpc/rpc_msg.h /usr/include/rpc/auth_sys.h \
+ /usr/include/rpc/auth_des.h /usr/include/rpc/auth_kerb.h \
+ /usr/include/kerberos/krb.h /usr/include/kerberos/mit-copyright.h \
+ /usr/include/kerberos/des.h /usr/include/sys/socket.h \
+ /usr/include/netinet/in.h /usr/include/sys/stream.h \
+ /usr/include/sys/vnode.h /usr/include/sys/uio.h /usr/include/vm/seg_enum.h \
+ /usr/include/sys/poll.h /usr/include/sys/strmdep.h /usr/include/rpc/svc.h \
+ /usr/include/rpc/svc_auth.h /usr/include/rpc/rpcb_clnt.h \
+ /usr/include/rpc/rpcb_prot.h
+service.o: service.cc /pkg/gnu/sparc-sun-solaris2.3/include/assert.h \
+ /pkg/gnu/lib/g++-include/stream.h /pkg/gnu/lib/g++-include/iostream.h \
+ /pkg/gnu/lib/g++-include/streambuf.h /pkg/gnu/lib/g++-include/libio.h \
+ /pkg/gnu/lib/g++-include/_G_config.h /usr/include/memory.h \
+ /usr/include/errno.h /usr/include/sys/errno.h \
+ /pkg/gnu/lib/gcc-lib/sparc-sun-solaris2.3/2.6.0/include/stdlib.h \
+ /usr/include/sys/feature_tests.h \
+ /pkg/gnu/lib/gcc-lib/sparc-sun-solaris2.3/2.6.0/include/sys/types.h \
+ /usr/include/sys/machtypes.h /usr/include/sys/select.h \
+ /usr/include/sys/time.h \
+ /pkg/gnu/lib/gcc-lib/sparc-sun-solaris2.3/2.6.0/include/time.h \
+ /usr/include/sys/siginfo.h /usr/include/sys/machsig.h \
+ /usr/include/sys/socket.h /usr/include/sys/netconfig.h \
+ /usr/include/netdb.h /usr/include/rpc/rpc.h /usr/include/rpc/types.h \
+ /usr/include/tiuser.h /usr/include/sys/tiuser.h /usr/include/fcntl.h \
+ /usr/include/sys/fcntl.h /usr/include/rpc/xdr.h \
+ /pkg/gnu/lib/gcc-lib/sparc-sun-solaris2.3/2.6.0/include/sys/byteorder.h \
+ /pkg/gnu/lib/gcc-lib/sparc-sun-solaris2.3/2.6.0/include/stdio.h \
+ /pkg/gnu/lib/gcc-lib/sparc-sun-solaris2.3/2.6.0/include/rpc/auth.h \
+ /usr/include/sys/cred.h /usr/include/sys/t_lock.h \
+ /usr/include/sys/machlock.h /usr/include/sys/dki_lkinfo.h \
+ /usr/include/sys/dl.h /usr/include/sys/sleepq.h \
+ /usr/include/sys/turnstile.h \
+ /pkg/gnu/lib/gcc-lib/sparc-sun-solaris2.3/2.6.0/include/sys/param.h \
+ /usr/include/sys/unistd.h /usr/include/sys/pirec.h \
+ /usr/include/sys/mutex.h /usr/include/rpc/clnt.h \
+ /usr/include/rpc/rpc_com.h /usr/include/rpc/rpc_msg.h \
+ /usr/include/rpc/auth_sys.h /usr/include/rpc/auth_des.h \
+ /usr/include/rpc/auth_kerb.h /usr/include/kerberos/krb.h \
+ /usr/include/kerberos/mit-copyright.h /usr/include/kerberos/des.h \
+ /usr/include/netinet/in.h /usr/include/sys/stream.h \
+ /usr/include/sys/vnode.h /usr/include/sys/uio.h /usr/include/vm/seg_enum.h \
+ /usr/include/sys/poll.h /usr/include/sys/strmdep.h /usr/include/rpc/svc.h \
+ /usr/include/rpc/svc_auth.h /usr/include/rpc/rpcb_clnt.h \
+ /usr/include/rpc/rpcb_prot.h rpc++/service.h \
+ /pkg/gnu/lib/g++-include/bool.h rpc++/request.h rpc++/xdr++.h \
+ rpc++/callback.h
+stub.o: stub.cc /pkg/gnu/lib/g++-include/stream.h \
+ /pkg/gnu/lib/g++-include/iostream.h /pkg/gnu/lib/g++-include/streambuf.h \
+ /pkg/gnu/lib/g++-include/libio.h /pkg/gnu/lib/g++-include/_G_config.h \
+ /usr/include/memory.h /pkg/gnu/sparc-sun-solaris2.3/include/assert.h \
+ rpc++/stub.h /pkg/gnu/lib/g++-include/bool.h \
+ /pkg/gnu/lib/g++-include/String.h /pkg/gnu/lib/g++-include/Regex.h \
+ /usr/include/sys/time.h /usr/include/sys/feature_tests.h \
+ /pkg/gnu/lib/gcc-lib/sparc-sun-solaris2.3/2.6.0/include/sys/types.h \
+ /usr/include/sys/machtypes.h /usr/include/sys/select.h \
+ /pkg/gnu/lib/gcc-lib/sparc-sun-solaris2.3/2.6.0/include/time.h \
+ /usr/include/sys/siginfo.h /usr/include/sys/machsig.h rpc++/request.h \
+ rpc++/xdr++.h /usr/include/rpc/rpc.h /usr/include/rpc/types.h \
+ /usr/include/tiuser.h /usr/include/sys/tiuser.h /usr/include/fcntl.h \
+ /usr/include/sys/fcntl.h /usr/include/rpc/xdr.h \
+ /pkg/gnu/lib/gcc-lib/sparc-sun-solaris2.3/2.6.0/include/sys/byteorder.h \
+ /pkg/gnu/lib/gcc-lib/sparc-sun-solaris2.3/2.6.0/include/stdio.h \
+ /pkg/gnu/lib/gcc-lib/sparc-sun-solaris2.3/2.6.0/include/rpc/auth.h \
+ /usr/include/sys/cred.h /usr/include/sys/t_lock.h \
+ /usr/include/sys/machlock.h /usr/include/sys/dki_lkinfo.h \
+ /usr/include/sys/dl.h /usr/include/sys/sleepq.h \
+ /usr/include/sys/turnstile.h \
+ /pkg/gnu/lib/gcc-lib/sparc-sun-solaris2.3/2.6.0/include/sys/param.h \
+ /usr/include/sys/unistd.h /usr/include/sys/pirec.h \
+ /usr/include/sys/mutex.h /usr/include/rpc/clnt.h \
+ /usr/include/rpc/rpc_com.h /usr/include/sys/netconfig.h \
+ /usr/include/rpc/rpc_msg.h /usr/include/rpc/auth_sys.h \
+ /usr/include/rpc/auth_des.h /usr/include/rpc/auth_kerb.h \
+ /usr/include/kerberos/krb.h /usr/include/kerberos/mit-copyright.h \
+ /usr/include/kerberos/des.h /usr/include/sys/socket.h \
+ /usr/include/netinet/in.h /usr/include/sys/stream.h \
+ /usr/include/sys/vnode.h /usr/include/sys/uio.h /usr/include/vm/seg_enum.h \
+ /usr/include/sys/poll.h /usr/include/sys/strmdep.h /usr/include/rpc/svc.h \
+ /usr/include/rpc/svc_auth.h /usr/include/rpc/rpcb_clnt.h \
+ /usr/include/rpc/rpcb_prot.h
+request.o: request.cc rpc++/request.h rpc++/xdr++.h /usr/include/rpc/rpc.h \
+ /usr/include/rpc/types.h \
+ /pkg/gnu/lib/gcc-lib/sparc-sun-solaris2.3/2.6.0/include/sys/types.h \
+ /usr/include/sys/feature_tests.h /usr/include/sys/machtypes.h \
+ /usr/include/sys/select.h /usr/include/sys/time.h \
+ /pkg/gnu/lib/gcc-lib/sparc-sun-solaris2.3/2.6.0/include/time.h \
+ /usr/include/sys/siginfo.h /usr/include/sys/machsig.h \
+ /usr/include/tiuser.h /usr/include/sys/tiuser.h /usr/include/fcntl.h \
+ /usr/include/sys/fcntl.h /usr/include/memory.h /usr/include/rpc/xdr.h \
+ /pkg/gnu/lib/gcc-lib/sparc-sun-solaris2.3/2.6.0/include/sys/byteorder.h \
+ /pkg/gnu/lib/gcc-lib/sparc-sun-solaris2.3/2.6.0/include/stdio.h \
+ /pkg/gnu/lib/gcc-lib/sparc-sun-solaris2.3/2.6.0/include/rpc/auth.h \
+ /usr/include/sys/cred.h /usr/include/sys/t_lock.h \
+ /usr/include/sys/machlock.h /usr/include/sys/dki_lkinfo.h \
+ /usr/include/sys/dl.h /usr/include/sys/sleepq.h \
+ /usr/include/sys/turnstile.h \
+ /pkg/gnu/lib/gcc-lib/sparc-sun-solaris2.3/2.6.0/include/sys/param.h \
+ /usr/include/sys/unistd.h /usr/include/sys/pirec.h \
+ /usr/include/sys/mutex.h /usr/include/rpc/clnt.h \
+ /usr/include/rpc/rpc_com.h /usr/include/sys/netconfig.h \
+ /usr/include/rpc/rpc_msg.h /usr/include/rpc/auth_sys.h \
+ /usr/include/rpc/auth_des.h /usr/include/rpc/auth_kerb.h \
+ /usr/include/kerberos/krb.h /usr/include/kerberos/mit-copyright.h \
+ /usr/include/kerberos/des.h /usr/include/sys/socket.h \
+ /usr/include/netinet/in.h /usr/include/sys/stream.h \
+ /usr/include/sys/vnode.h /usr/include/sys/uio.h /usr/include/vm/seg_enum.h \
+ /usr/include/sys/poll.h /usr/include/sys/strmdep.h /usr/include/rpc/svc.h \
+ /usr/include/rpc/svc_auth.h /usr/include/rpc/rpcb_clnt.h \
+ /usr/include/rpc/rpcb_prot.h \
+ /pkg/gnu/sparc-sun-solaris2.3/include/assert.h
+callback.o: callback.cc rpc++/callback.h
diff --git a/rpc++/COPYING b/rpc++/COPYING
new file mode 100644
index 00000000000..eb685a5ec98
--- /dev/null
+++ b/rpc++/COPYING
@@ -0,0 +1,481 @@
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1991 Free Software Foundation, Inc.
+ 675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the library GPL. It is
+ numbered 2 because it goes with version 2 of the ordinary GPL.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Library General Public License, applies to some
+specially designated Free Software Foundation software, and to any
+other libraries whose authors decide to use it. You can use it for
+your libraries, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if
+you distribute copies of the library, or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link a program with the library, you must provide
+complete object files to the recipients so that they can relink them
+with the library, after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ Our method of protecting your rights has two steps: (1) copyright
+the library, and (2) offer you this license which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ Also, for each distributor's protection, we want to make certain
+that everyone understands that there is no warranty for this free
+library. If the library is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original
+version, so that any problems introduced by others will not reflect on
+the original authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that companies distributing free
+software will individually obtain patent licenses, thus in effect
+transforming the program into proprietary software. To prevent this,
+we have made it clear that any patent must be licensed for everyone's
+free use or not licensed at all.
+
+ Most GNU software, including some libraries, is covered by the ordinary
+GNU General Public License, which was designed for utility programs. This
+license, the GNU Library General Public License, applies to certain
+designated libraries. This license is quite different from the ordinary
+one; be sure to read it in full, and don't assume that anything in it is
+the same as in the ordinary license.
+
+ The reason we have a separate public license for some libraries is that
+they blur the distinction we usually make between modifying or adding to a
+program and simply using it. Linking a program with a library, without
+changing the library, is in some sense simply using the library, and is
+analogous to running a utility program or application program. However, in
+a textual and legal sense, the linked executable is a combined work, a
+derivative of the original library, and the ordinary General Public License
+treats it as such.
+
+ Because of this blurred distinction, using the ordinary General
+Public License for libraries did not effectively promote software
+sharing, because most developers did not use the libraries. We
+concluded that weaker conditions might promote sharing better.
+
+ However, unrestricted linking of non-free programs would deprive the
+users of those programs of all benefit from the free status of the
+libraries themselves. This Library General Public License is intended to
+permit developers of non-free programs to use free libraries, while
+preserving your freedom as a user of such programs to change the free
+libraries that are incorporated in them. (We have not seen how to achieve
+this as regards changes in header files, but we have achieved it as regards
+changes in the actual functions of the Library.) The hope is that this
+will lead to faster development of free libraries.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, while the latter only
+works together with the library.
+
+ Note that it is possible for a library to be covered by the ordinary
+General Public License rather than by this special one.
+
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library which
+contains a notice placed by the copyright holder or other authorized
+party saying it may be distributed under the terms of this Library
+General Public License (also called "this License"). Each licensee is
+addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also compile or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ c) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ d) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the source code distributed need not include anything that is normally
+distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Library General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ Appendix: How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
diff --git a/rpc++/Makefile b/rpc++/Makefile
new file mode 100644
index 00000000000..6b4819d2b7a
--- /dev/null
+++ b/rpc++/Makefile
@@ -0,0 +1,55 @@
+TOP = .
+SUBDIRS = StdHdrs example
+
+INSTROOT = ../..
+
+CC = gcc
+CFLAGS = -ggdb
+C++FLAGS = $(CFLAGS)
+
+LIBHDRS = rpc++/xdr++.h rpc++/request.h rpc++/service.h rpc++/stub.h \
+ rpc++/callback.h version.h
+LIBSRCS = xdr++.cc service.cc stub.cc request.cc callback.cc
+
+LIBOBJS = $(LIBSRCS:%.cc=%.o) $(GENSRCS:%.cc=%.o)
+
+all:: librpc++.a
+
+subdirs.all:: librpc++.a
+
+librpc++.a: $(LIBOBJS)
+ rm -f $@
+ ar cq $@ $(LIBOBJS)
+ if [ -x /bin/ranlib -o -x /usr/bin/ranlib ]; then ranlib $@; fi
+
+install:: librpc++.a
+ install -d $(INSTROOT)/lib
+ if cmp -s librpc++.a $(INSTROOT)/lib/librpc++.a; then : ; \
+ else rm -f $(INSTROOT)/lib/librpc++.a; \
+ cp -p librpc++.a $(INSTROOT)/lib; \
+ chmod 444 $(INSTROOT)/lib/librpc++.a; \
+ for f in rpc++/*.h; do \
+ rm -f $(INSTROOT)/include/$$f; done; fi
+ install -d $(INSTROOT)/include/rpc++
+ for f in rpc++/*.h; do \
+ cmp -s $$f $(INSTROOT)/include/$$f \
+ || install -c -m 444 $$f $(INSTROOT)/include/rpc++; done
+
+DISTLIST = Makefile README.ORIG README COPYING Proj.make rpc++.texi \
+ gcc-2.2.2.fix $(LIBHDRS) $(LIBSRCS)
+
+clean::
+ rm -f $(CLEANWILDCARDS) librpc++.a
+
+include .dependencies
+
+.dependencies: $(LIBHDRS) $(LIBSRCS)
+ gcc -M $(CPPFLAGS) $(LIBSRCS) > .dependencies
+
+distlist::
+ @for f in *.[ch] *.cc; do \
+ if expr " $(DISTLIST) " : ".* $$f " >/dev/null; then : ; \
+ else echo 1>&2 "Warning: c- or h-file \"$$f\" not in DISTLIST"; fi; \
+ done
+
+include $(TOP)/Proj.make
diff --git a/rpc++/Proj.make b/rpc++/Proj.make
new file mode 100644
index 00000000000..af50f2f11bf
--- /dev/null
+++ b/rpc++/Proj.make
@@ -0,0 +1,68 @@
+# These are included in every Makefile in the project
+
+CWDPATH = .
+CLEANWILDCARDS = core *~ *.o
+VERYCLEANWILDCARDS = core *~ *.o
+TEXCLEANWILDCARD = *~ *.aux *.log *.bbl *.blg *.toc *.idx *.ind
+TEXVERYCLEANWILDCARD = $(TEXCLEANWILDCARD) *.dvi
+ifndef SUBDIRS
+SUBDIRS =
+endif
+
+# Doing all always means doing the subdirs.
+# Make subdirs.all a target to allow forced processing
+ifneq ("$(SUBDIRS)", "")
+ifneq ("$(SUBDIRSALL)", "NO")
+all:: subdirs.all
+endif
+
+subdirs.all::
+ @for d in $(SUBDIRS); do \
+ (cd $$d; \
+ smflags=$(SUBMFLAGS); \
+ echo "Making all in $$d with flags: $$smflags ..." ; \
+ echo "cd `pwd`"; \
+ $(MAKE) $$smflags all); done; \
+ echo "cd `pwd`"
+else
+all::;
+endif
+
+ifneq ("$(SUBDIRS)", "")
+clean:: subdirs.clean
+
+subdirs.clean::
+ @for d in $(SUBDIRS); do \
+ echo "Cleaning all in $$d..." ; \
+ (cd $$d; $(MAKE) clean); done
+else
+clean::;
+endif
+
+ifneq ("$(SUBDIRS)", "")
+veryclean:: subdirs.veryclean
+
+subdirs.veryclean::
+ @for d in $(SUBDIRS); do \
+ echo "Verycleaning all in $$d..." ; \
+ (cd $$d; $(MAKE) veryclean); done
+else
+veryclean::;
+endif
+
+# dist.list prints a list of files to be included in the distribution
+distlist::
+ifneq ("$(DISTLIST)", "")
+ @for f in $(DISTLIST); do \
+ echo $(CWDPATH)/$$f; done
+endif
+ifneq ("$(SUBDIRS)", "")
+ifneq ("$(SUBDIRSDIST)", "NO")
+ @for d in $(SUBDIRS); do \
+ (cd $$d; $(MAKE) distlist CWDPATH=$(CWDPATH)/$$d); done
+endif
+endif
+ifeq ("$(DISTLIST)$(SUBDIRS)","")
+
+endif
+
diff --git a/rpc++/README b/rpc++/README
new file mode 100644
index 00000000000..bede31dd376
--- /dev/null
+++ b/rpc++/README
@@ -0,0 +1,18 @@
+This directory contains the sources for a C++ interface to Sun RPCs.
+
+As far as I remember, I got the original sources of the rpc++-library
+from some newsgroup, though I don't remember which one. I liked the
+basic idea but disliked several aspects of the interface details. So I
+adapted it to my likes. I intended some minor changes but soon found
+myself renaming classes, changing method parameters, introducing new
+classes, etc. The result is by no way compatible with the original
+version. It is, I hope, nevertheless useful.
+
+The current version 2.2 of the rpc++ library updates the version 2.1
+posted in March 1991. It is the reaction to gcc-2.2 that finally
+allows a sufficiently reliable use of templates (almost, see
+Installation in rpc++.texi)
+
+Michael Lipp
+
+<mnl@dtro.e-technik.th-darmstadt.de>
diff --git a/rpc++/README.ORIG b/rpc++/README.ORIG
new file mode 100644
index 00000000000..60aa3f121e1
--- /dev/null
+++ b/rpc++/README.ORIG
@@ -0,0 +1,9 @@
+This directory contains a collection of classes that provide an
+interface to SUN's RPCs. I dubbed the collection the rpc++-library. It
+has been tested with gcc-1.40 on a SparcStation running SunOS 4.0.
+
+There is no documentation. Look at the example in ./example.
+
+Peter Berens
+
+
diff --git a/rpc++/StdHdrs/Makefile b/rpc++/StdHdrs/Makefile
new file mode 100644
index 00000000000..404499ce0cc
--- /dev/null
+++ b/rpc++/StdHdrs/Makefile
@@ -0,0 +1,13 @@
+TOP = ..
+SUBDIRS = rpc
+SUBDIRSALL = NO
+SUBDIRSDIST = NO
+
+all::
+
+clean::
+ rm -f $(CLEANWILDCARDS)
+
+DISTLIST = Makefile README $(wildcard rpc/*.h)
+
+include $(TOP)/Proj.make
diff --git a/rpc++/StdHdrs/README b/rpc++/StdHdrs/README
new file mode 100644
index 00000000000..c9f9f5e20e5
--- /dev/null
+++ b/rpc++/StdHdrs/README
@@ -0,0 +1,3 @@
+This directory contains some of Sun's rpc headers that have been fixed
+(though not thoroughly) to work with ANSI C and C++. I have installed
+them in my standard C include path.
diff --git a/rpc++/StdHdrs/rpc/auth.h b/rpc++/StdHdrs/rpc/auth.h
new file mode 100644
index 00000000000..82b22c76b29
--- /dev/null
+++ b/rpc++/StdHdrs/rpc/auth.h
@@ -0,0 +1,171 @@
+/* @(#)auth.h 2.3 88/08/07 4.0 RPCSRC; from 1.17 88/02/08 SMI */
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+
+/*
+ * auth.h, Authentication interface.
+ *
+ * Copyright (C) 1984, Sun Microsystems, Inc.
+ *
+ * The data structures are completely opaque to the client. The client
+ * is required to pass a AUTH * to routines that create rpc
+ * "sessions".
+ */
+
+
+#ifndef _rpc_auth_h
+#define _rpc_auth_h
+
+#define MAX_AUTH_BYTES 400
+#define MAXNETNAMELEN 255 /* maximum length of network user's name */
+
+/*
+ * Status returned from authentication check
+ */
+enum auth_stat {
+ AUTH_OK=0,
+ /*
+ * failed at remote end
+ */
+ AUTH_BADCRED=1, /* bogus credentials (seal broken) */
+ AUTH_REJECTEDCRED=2, /* client should begin new session */
+ AUTH_BADVERF=3, /* bogus verifier (seal broken) */
+ AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */
+ AUTH_TOOWEAK=5, /* rejected due to security reasons */
+ /*
+ * failed locally
+ */
+ AUTH_INVALIDRESP=6, /* bogus response verifier */
+ AUTH_FAILED=7 /* some unknown reason */
+};
+
+#if (__mc68000__ || __sparc__ || __vax__ || __i386__)
+typedef u_long u_int32; /* 32-bit unsigned integers */
+#endif
+
+union des_block {
+ struct {
+ u_int32 high;
+ u_int32 low;
+ } key;
+ char c[8];
+};
+typedef union des_block des_block;
+extern bool_t xdr_des_block();
+
+/*
+ * Authentication info. Opaque to client.
+ */
+struct opaque_auth {
+ enum_t oa_flavor; /* flavor of auth */
+ caddr_t oa_base; /* address of more auth stuff */
+ u_int oa_length; /* not to exceed MAX_AUTH_BYTES */
+};
+
+
+/*
+ * Auth handle, interface to client side authenticators.
+ */
+typedef struct {
+ struct opaque_auth ah_cred;
+ struct opaque_auth ah_verf;
+ union des_block ah_key;
+ struct auth_ops {
+ void (*ah_nextverf)();
+ int (*ah_marshal)(); /* nextverf & serialize */
+ int (*ah_validate)(); /* validate varifier */
+ int (*ah_refresh)(); /* refresh credentials */
+ void (*ah_destroy)(); /* destroy this structure */
+ } *ah_ops;
+ caddr_t ah_private;
+} AUTH;
+
+
+/*
+ * Authentication ops.
+ * The ops and the auth handle provide the interface to the authenticators.
+ *
+ * AUTH *auth;
+ * XDR *xdrs;
+ * struct opaque_auth verf;
+ */
+#define AUTH_NEXTVERF(auth) \
+ ((*((auth)->ah_ops->ah_nextverf))(auth))
+#define auth_nextverf(auth) \
+ ((*((auth)->ah_ops->ah_nextverf))(auth))
+
+#define AUTH_MARSHALL(auth, xdrs) \
+ ((*((auth)->ah_ops->ah_marshal))(auth, xdrs))
+#define auth_marshall(auth, xdrs) \
+ ((*((auth)->ah_ops->ah_marshal))(auth, xdrs))
+
+#define AUTH_VALIDATE(auth, verfp) \
+ ((*((auth)->ah_ops->ah_validate))((auth), verfp))
+#define auth_validate(auth, verfp) \
+ ((*((auth)->ah_ops->ah_validate))((auth), verfp))
+
+#define AUTH_REFRESH(auth) \
+ ((*((auth)->ah_ops->ah_refresh))(auth))
+#define auth_refresh(auth) \
+ ((*((auth)->ah_ops->ah_refresh))(auth))
+
+#define AUTH_DESTROY(auth) \
+ ((*((auth)->ah_ops->ah_destroy))(auth))
+#define auth_destroy(auth) \
+ ((*((auth)->ah_ops->ah_destroy))(auth))
+
+
+extern struct opaque_auth _null_auth;
+
+
+/*
+ * These are the various implementations of client side authenticators.
+ */
+
+/*
+ * Unix style authentication
+ * AUTH *authunix_create(machname, uid, gid, len, aup_gids)
+ * char *machname;
+ * int uid;
+ * int gid;
+ * int len;
+ * int *aup_gids;
+ */
+extern AUTH *authunix_create();
+extern AUTH *authunix_create_default(); /* takes no parameters */
+extern AUTH *authnone_create(); /* takes no parameters */
+extern AUTH *authdes_create();
+
+#define AUTH_NONE 0 /* no authentication */
+#define AUTH_NULL 0 /* backward compatibility */
+#define AUTH_UNIX 1 /* unix style (uid, gids) */
+#define AUTH_SHORT 2 /* short hand unix style */
+#define AUTH_DES 3 /* des style (encrypted timestamps) */
+
+#endif /*!_rpc_auth_h*/
diff --git a/rpc++/StdHdrs/rpc/c_types.h b/rpc++/StdHdrs/rpc/c_types.h
new file mode 100644
index 00000000000..eac882f1082
--- /dev/null
+++ b/rpc++/StdHdrs/rpc/c_types.h
@@ -0,0 +1,79 @@
+#ifndef _rpc_c_types_h_
+#define _rpc_c_types_h_
+
+#if defined(__cplusplus)
+ /*
+ * Definitions for C++ 2.0 and later require extern "C" { decl; }
+ */
+# define EXTERN_FUNCTION( rtn, args ) extern "C" { rtn args; }
+# define FUN_ARGS( args ) args
+# define STRUCT_TAG( tag_name ) /* the tag disappears */
+# define ENUM_BITFIELD( enum_type ) unsigned
+# define ENUM_TYPE( enum_sp, enum_ty ) enum_ty
+
+#if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
+# define NAME_CONFLICT( name ) _##name
+#else
+# define NAME_CONFLICT( name ) _/**/name
+#endif
+
+# define DOTDOTDOT ...
+# define _VOID_ /* anachronism */
+# define CONST const
+
+/*
+ * This is not necessary for 2.0 since 2.0 has corrected the void (*) () problem
+ */
+typedef void (*_PFV_)();
+typedef int (*_PFI_)();
+
+#elif defined(c_plusplus)
+ /*
+ * Definitions for C++ 1.2
+ */
+# define EXTERN_FUNCTION( rtn, args ) rtn args
+# define FUN_ARGS( args ) args
+# define STRUCT_TAG( tag_name ) /* the tag disappears */
+# define ENUM_BITFIELD( enum_type ) unsigned
+# define ENUM_TYPE( enum_sp, enum_ty ) enum_ty
+# define NAME_CONFLICT( name ) _/**/name
+# define DOTDOTDOT ...
+# define _VOID_ /* anachronism */
+# define CONST const
+
+typedef void (*_PFV_)();
+typedef int (*_PFI_)();
+
+#elif defined(__STDC__)
+ /*
+ * Definitions for ANSI C
+ */
+# define EXTERN_FUNCTION( rtn, args ) rtn args
+# define FUN_ARGS( args ) args
+# define STRUCT_TAG( tag_name ) tag_name
+# define ENUM_BITFIELD( enum_type ) unsigned
+# define ENUM_TYPE( enum_sp, enum_ty ) enum_sp enum_ty
+# define NAME_CONFLICT( name ) name
+# define DOTDOTDOT ...
+# define _VOID_ void
+# define CONST
+
+#else
+ /*
+ * Definitions for Sun/K&R C -- ignore function prototypes,
+ * but preserve tag names and enum bitfield declarations.
+ */
+# define EXTERN_FUNCTION( rtn, args ) rtn()
+# define FUN_ARGS( args ) ()
+# define STRUCT_TAG( tag_name ) tag_name
+# define ENUM_BITFIELD( enum_type ) enum_type
+# define ENUM_TYPE( enum_sp, enum_ty ) enum_sp enum_ty
+# define NAME_CONFLICT( name ) name
+# define DOTDOTDOT
+# define _VOID_
+ /* VOID is only used where it disappears anyway */
+# define CONST
+
+#endif /* Which type of C/C++ compiler are we using? */
+
+#endif
diff --git a/rpc++/StdHdrs/rpc/clnt.h b/rpc++/StdHdrs/rpc/clnt.h
new file mode 100644
index 00000000000..4cb303bc1eb
--- /dev/null
+++ b/rpc++/StdHdrs/rpc/clnt.h
@@ -0,0 +1,347 @@
+/* @(#)clnt.h 2.1 88/07/29 4.0 RPCSRC; from 1.31 88/02/08 SMI*/
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+
+/*
+ * clnt.h - Client side remote procedure call interface.
+ *
+ * Copyright (C) 1984, Sun Microsystems, Inc.
+ */
+
+#ifndef _rpc_clnt_h
+#define _rpc_clnt_h
+
+/*
+ * Rpc calls return an enum clnt_stat. This should be looked at more,
+ * since each implementation is required to live with this (implementation
+ * independent) list of errors.
+ */
+enum clnt_stat {
+ RPC_SUCCESS=0, /* call succeeded */
+ /*
+ * local errors
+ */
+ RPC_CANTENCODEARGS=1, /* can't encode arguments */
+ RPC_CANTDECODERES=2, /* can't decode results */
+ RPC_CANTSEND=3, /* failure in sending call */
+ RPC_CANTRECV=4, /* failure in receiving result */
+ RPC_TIMEDOUT=5, /* call timed out */
+ /*
+ * remote errors
+ */
+ RPC_VERSMISMATCH=6, /* rpc versions not compatible */
+ RPC_AUTHERROR=7, /* authentication error */
+ RPC_PROGUNAVAIL=8, /* program not available */
+ RPC_PROGVERSMISMATCH=9, /* program version mismatched */
+ RPC_PROCUNAVAIL=10, /* procedure unavailable */
+ RPC_CANTDECODEARGS=11, /* decode arguments error */
+ RPC_SYSTEMERROR=12, /* generic "other problem" */
+
+ /*
+ * callrpc & clnt_create errors
+ */
+ RPC_UNKNOWNHOST=13, /* unknown host name */
+ RPC_UNKNOWNPROTO=17, /* unkown protocol */
+
+ /*
+ * _ create errors
+ */
+ RPC_PMAPFAILURE=14, /* the pmapper failed in its call */
+ RPC_PROGNOTREGISTERED=15, /* remote program is not registered */
+ /*
+ * unspecified error
+ */
+ RPC_FAILED=16
+};
+
+
+/*
+ * Error info.
+ */
+struct rpc_err {
+ enum clnt_stat re_status;
+ union {
+ int RE_errno; /* realated system error */
+ enum auth_stat RE_why; /* why the auth error occurred */
+ struct {
+ u_long low; /* lowest verion supported */
+ u_long high; /* highest verion supported */
+ } RE_vers;
+ struct { /* maybe meaningful if RPC_FAILED */
+ long s1;
+ long s2;
+ } RE_lb; /* life boot & debugging only */
+ } ru;
+#define re_errno ru.RE_errno
+#define re_why ru.RE_why
+#define re_vers ru.RE_vers
+#define re_lb ru.RE_lb
+};
+
+
+/*
+ * Client rpc handle.
+ * Created by individual implementations, see e.g. rpc_udp.c.
+ * Client is responsible for initializing auth, see e.g. auth_none.c.
+ */
+typedef struct {
+ AUTH *cl_auth; /* authenticator */
+ struct clnt_ops {
+ enum clnt_stat (*cl_call)(DOTDOTDOT); /* call remote procedure */
+ void (*cl_abort)(DOTDOTDOT); /* abort a call */
+ void (*cl_geterr)(DOTDOTDOT); /* get specific error code */
+ bool_t (*cl_freeres)(DOTDOTDOT); /* frees results */
+ void (*cl_destroy)(DOTDOTDOT);/* destroy this structure */
+ bool_t (*cl_control)(DOTDOTDOT);/* the ioctl() of rpc */
+ } *cl_ops;
+ caddr_t cl_private; /* private stuff */
+} CLIENT;
+
+
+/*
+ * client side rpc interface ops
+ *
+ * Parameter types are:
+ *
+ */
+
+/*
+ * enum clnt_stat
+ * CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout)
+ * CLIENT *rh;
+ * u_long proc;
+ * xdrproc_t xargs;
+ * caddr_t argsp;
+ * xdrproc_t xres;
+ * caddr_t resp;
+ * struct timeval timeout;
+ */
+#define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \
+ ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs))
+#define clnt_call(rh, proc, xargs, argsp, xres, resp, secs) \
+ ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs))
+
+/*
+ * void
+ * CLNT_ABORT(rh);
+ * CLIENT *rh;
+ */
+#define CLNT_ABORT(rh) ((*(rh)->cl_ops->cl_abort)(rh))
+#define clnt_abort(rh) ((*(rh)->cl_ops->cl_abort)(rh))
+
+/*
+ * struct rpc_err
+ * CLNT_GETERR(rh);
+ * CLIENT *rh;
+ */
+#define CLNT_GETERR(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp))
+#define clnt_geterr(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp))
+
+
+/*
+ * bool_t
+ * CLNT_FREERES(rh, xres, resp);
+ * CLIENT *rh;
+ * xdrproc_t xres;
+ * caddr_t resp;
+ */
+#define CLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
+#define clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
+
+/*
+ * bool_t
+ * CLNT_CONTROL(cl, request, info)
+ * CLIENT *cl;
+ * u_int request;
+ * char *info;
+ */
+#define CLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))
+#define clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))
+
+/*
+ * control operations that apply to both udp and tcp transports
+ */
+#define CLSET_TIMEOUT 1 /* set timeout (timeval) */
+#define CLGET_TIMEOUT 2 /* get timeout (timeval) */
+#define CLGET_SERVER_ADDR 3 /* get server's address (sockaddr) */
+/*
+ * udp only control operations
+ */
+#define CLSET_RETRY_TIMEOUT 4 /* set retry timeout (timeval) */
+#define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */
+
+/*
+ * void
+ * CLNT_DESTROY(rh);
+ * CLIENT *rh;
+ */
+#define CLNT_DESTROY(rh) ((*(rh)->cl_ops->cl_destroy)(rh))
+#define clnt_destroy(rh) ((*(rh)->cl_ops->cl_destroy)(rh))
+
+
+/*
+ * RPCTEST is a test program which is accessable on every rpc
+ * transport/port. It is used for testing, performance evaluation,
+ * and network administration.
+ */
+
+#define RPCTEST_PROGRAM ((u_long)1)
+#define RPCTEST_VERSION ((u_long)1)
+#define RPCTEST_NULL_PROC ((u_long)2)
+#define RPCTEST_NULL_BATCH_PROC ((u_long)3)
+
+/*
+ * By convention, procedure 0 takes null arguments and returns them
+ */
+
+#define NULLPROC ((u_long)0)
+
+/*
+ * Below are the client handle creation routines for the various
+ * implementations of client side rpc. They can return NULL if a
+ * creation failure occurs.
+ */
+
+/*
+ * Memory based rpc (for speed check and testing)
+ * CLIENT *
+ * clntraw_create(prog, vers)
+ * u_long prog;
+ * u_long vers;
+ */
+EXTERN_FUNCTION(CLIENT *clntraw_create, (u_long prog, u_long vers));
+
+
+/*
+ * Generic client creation routine. Supported protocols are "udp" and "tcp"
+ */
+EXTERN_FUNCTION(CLIENT *
+clnt_create, (char* host, u_long prog, u_long vers, char* prot));
+/*
+ char *host; -- hostname
+ u_long prog; -- program number
+ u_long vers; -- version number
+ char *prot; -- protocol
+*/
+
+
+
+
+/*
+ * TCP based rpc
+ * CLIENT *
+ * clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz)
+ * struct sockaddr_in *raddr;
+ * u_long prog;
+ * u_long version;
+ * register int *sockp;
+ * u_int sendsz;
+ * u_int recvsz;
+ */
+EXTERN_FUNCTION(CLIENT *clnttcp_create, (struct sockaddr_in *raddr,
+ u_long prog,
+ u_long version,
+ register int *sockp,
+ u_int sendsz,
+ u_int recvsz));
+
+/*
+ * UDP based rpc.
+ * CLIENT *
+ * clntudp_create(raddr, program, version, wait, sockp)
+ * struct sockaddr_in *raddr;
+ * u_long program;
+ * u_long version;
+ * struct timeval wait;
+ * int *sockp;
+ *
+ * Same as above, but you specify max packet sizes.
+ * CLIENT *
+ * clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz)
+ * struct sockaddr_in *raddr;
+ * u_long program;
+ * u_long version;
+ * struct timeval wait;
+ * int *sockp;
+ * u_int sendsz;
+ * u_int recvsz;
+ */
+EXTERN_FUNCTION(CLIENT *clntudp_create, (struct sockaddr_in *raddr,
+ u_long program,
+ u_long version,
+ struct timeval wait,
+ int *sockp));
+EXTERN_FUNCTION(CLIENT *clntudp_bufcreate, (struct sockaddr_in *raddr,
+ u_long program,
+ u_long version,
+ struct timeval wait,
+ int *sockp,
+ u_int sendsz,
+ u_int recvsz));
+
+/*
+ * Print why creation failed
+ */
+EXTERN_FUNCTION(void clnt_pcreateerror, (char *msg)); /* stderr */
+EXTERN_FUNCTION(char *clnt_spcreateerror, (char *msg)); /* string */
+
+/*
+ * Like clnt_perror(), but is more verbose in its output
+ */
+EXTERN_FUNCTION(void clnt_perrno, (enum clnt_stat num)); /* stderr */
+
+/*
+ * Print an English error message, given the client error code
+ */
+EXTERN_FUNCTION(void clnt_perror, (CLIENT *clnt, char *msg)); /* stderr */
+EXTERN_FUNCTION(char *clnt_sperror, (CLIENT *clnt, char *msg)); /* string */
+
+/*
+ * If a creation fails, the following allows the user to figure out why.
+ */
+struct rpc_createerr {
+ enum clnt_stat cf_stat;
+ struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */
+};
+
+extern struct rpc_createerr rpc_createerr;
+
+
+
+/*
+ * Copy error message to buffer.
+ */
+EXTERN_FUNCTION(char *clnt_sperrno, (enum clnt_stat num)); /* string */
+
+
+
+#define UDPMSGSIZE 8800 /* rpc imposed limit on udp msg size */
+#define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */
+
+#endif /*!_rpc_clnt_h*/
diff --git a/rpc++/StdHdrs/rpc/pmap_clnt.h b/rpc++/StdHdrs/rpc/pmap_clnt.h
new file mode 100644
index 00000000000..0a209e4f00f
--- /dev/null
+++ b/rpc++/StdHdrs/rpc/pmap_clnt.h
@@ -0,0 +1,82 @@
+/* @(#)pmap_clnt.h 2.1 88/07/29 4.0 RPCSRC; from 1.11 88/02/08 SMI */
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+
+/*
+ * pmap_clnt.h
+ * Supplies C routines to get to portmap services.
+ *
+ * Copyright (C) 1984, Sun Microsystems, Inc.
+ */
+
+/*
+ * Usage:
+ * success = pmap_set(program, version, protocol, port);
+ * success = pmap_unset(program, version);
+ * port = pmap_getport(address, program, version, protocol);
+ * head = pmap_getmaps(address);
+ * clnt_stat = pmap_rmtcall(address, program, version, procedure,
+ * xdrargs, argsp, xdrres, resp, tout, port_ptr)
+ * (works for udp only.)
+ * clnt_stat = clnt_broadcast(program, version, procedure,
+ * xdrargs, argsp, xdrres, resp, eachresult)
+ * (like pmap_rmtcall, except the call is broadcasted to all
+ * locally connected nets. For each valid response received,
+ * the procedure eachresult is called. Its form is:
+ * done = eachresult(resp, raddr)
+ * bool_t done;
+ * caddr_t resp;
+ * struct sockaddr_in raddr;
+ * where resp points to the results of the call and raddr is the
+ * address if the responder to the broadcast.
+ */
+
+#ifndef _rpc_pmap_clnt_h
+#define _rpc_pmap_clnt_h
+
+#include <rpc/c_types.h>
+
+EXTERN_FUNCTION(bool_t pmap_set, (u_long prognum, u_long versnum,
+ int protocol, u_short port));
+EXTERN_FUNCTION(bool_t pmap_unset, (u_long prognum, u_long versnum));
+EXTERN_FUNCTION(struct pmaplist *pmap_getmaps, (struct sockaddr_in *addr));
+EXTERN_FUNCTION(enum clnt_stat pmap_rmtcall, (struct sockaddr_in *addr,
+ u_long prognum, u_long versnum,
+ u_long procnum,
+ char *in, char *out,
+ xdrproc_t inproc,
+ xdrproc_t outproc,
+ struct timeval timeout,
+ u_long *portp));
+EXTERN_FUNCTION(enum clnt_stat clnt_broadcast, ());
+EXTERN_FUNCTION(u_short pmap_getport, (struct sockaddr_in *addr,
+ u_long prognum, u_long versnum,
+ u_long protocol));
+
+#endif /*!_rpc_pmap_clnt_h*/
diff --git a/rpc++/StdHdrs/rpc/svc.h b/rpc++/StdHdrs/rpc/svc.h
new file mode 100644
index 00000000000..4e551e55fd5
--- /dev/null
+++ b/rpc++/StdHdrs/rpc/svc.h
@@ -0,0 +1,286 @@
+/* @(#)svc.h 2.2 88/07/29 4.0 RPCSRC; from 1.20 88/02/08 SMI */
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+
+/*
+ * svc.h, Server-side remote procedure call interface.
+ *
+ * Copyright (C) 1984, Sun Microsystems, Inc.
+ */
+
+#ifndef _rpc_svc_h
+#define _rpc_svc_h
+
+#include <rpc/pmap_clnt.h>
+
+/*
+ * This interface must manage two items concerning remote procedure calling:
+ *
+ * 1) An arbitrary number of transport connections upon which rpc requests
+ * are received. The two most notable transports are TCP and UDP; they are
+ * created and registered by routines in svc_tcp.c and svc_udp.c, respectively;
+ * they in turn call xprt_register and xprt_unregister.
+ *
+ * 2) An arbitrary number of locally registered services. Services are
+ * described by the following four data: program number, version number,
+ * "service dispatch" function, a transport handle, and a boolean that
+ * indicates whether or not the exported program should be registered with a
+ * local binder service; if true the program's number and version and the
+ * port number from the transport handle are registered with the binder.
+ * These data are registered with the rpc svc system via svc_register.
+ *
+ * A service's dispatch function is called whenever an rpc request comes in
+ * on a transport. The request's program and version numbers must match
+ * those of the registered service. The dispatch function is passed two
+ * parameters, struct svc_req * and SVCXPRT *, defined below.
+ */
+
+enum xprt_stat {
+ XPRT_DIED,
+ XPRT_MOREREQS,
+ XPRT_IDLE
+};
+
+/*
+ * Server side transport handle
+ */
+typedef struct {
+ int xp_sock;
+ u_short xp_port; /* associated port number */
+ struct xp_ops {
+ bool_t (*xp_recv)(DOTDOTDOT); /* receive incomming requests */
+ enum xprt_stat (*xp_stat)(DOTDOTDOT); /* get transport status */
+ bool_t (*xp_getargs)(DOTDOTDOT); /* get arguments */
+ bool_t (*xp_reply)(DOTDOTDOT); /* send reply */
+ bool_t (*xp_freeargs)(DOTDOTDOT);/* free mem allocated for args */
+ void (*xp_destroy)(DOTDOTDOT); /* destroy this struct */
+ } *xp_ops;
+ int xp_addrlen; /* length of remote address */
+ struct sockaddr_in xp_raddr; /* remote address */
+ struct opaque_auth xp_verf; /* raw response verifier */
+ caddr_t xp_p1; /* private */
+ caddr_t xp_p2; /* private */
+} SVCXPRT;
+
+/*
+ * Approved way of getting address of caller
+ */
+#define svc_getcaller(x) (&(x)->xp_raddr)
+
+/*
+ * Operations defined on an SVCXPRT handle
+ *
+ * SVCXPRT *xprt;
+ * struct rpc_msg *msg;
+ * xdrproc_t xargs;
+ * caddr_t argsp;
+ */
+#define SVC_RECV(xprt, msg) \
+ (*(xprt)->xp_ops->xp_recv)((xprt), (msg))
+#define svc_recv(xprt, msg) \
+ (*(xprt)->xp_ops->xp_recv)((xprt), (msg))
+
+#define SVC_STAT(xprt) \
+ (*(xprt)->xp_ops->xp_stat)(xprt)
+#define svc_stat(xprt) \
+ (*(xprt)->xp_ops->xp_stat)(xprt)
+
+#define SVC_GETARGS(xprt, xargs, argsp) \
+ (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp))
+#define svc_getargs(xprt, xargs, argsp) \
+ (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp))
+
+#define SVC_REPLY(xprt, msg) \
+ (*(xprt)->xp_ops->xp_reply) ((xprt), (msg))
+#define svc_reply(xprt, msg) \
+ (*(xprt)->xp_ops->xp_reply) ((xprt), (msg))
+
+#define SVC_FREEARGS(xprt, xargs, argsp) \
+ (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp))
+#define svc_freeargs(xprt, xargs, argsp) \
+ (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp))
+
+#define SVC_DESTROY(xprt) \
+ (*(xprt)->xp_ops->xp_destroy)(xprt)
+#define svc_destroy(xprt) \
+ (*(xprt)->xp_ops->xp_destroy)(xprt)
+
+
+/*
+ * Service request
+ */
+struct svc_req {
+ u_long rq_prog; /* service program number */
+ u_long rq_vers; /* service protocol version */
+ u_long rq_proc; /* the desired procedure */
+ struct opaque_auth rq_cred; /* raw creds from the wire */
+ caddr_t rq_clntcred; /* read only cooked cred */
+ SVCXPRT *rq_xprt; /* associated transport */
+};
+
+
+/*
+ * Service registration
+ *
+ * svc_register(xprt, prog, vers, dispatch, protocol)
+ * SVCXPRT *xprt;
+ * u_long prog;
+ * u_long vers;
+ * void (*dispatch)();
+ * int protocol; like TCP or UDP, zero means do not register
+ */
+EXTERN_FUNCTION(bool_t svc_register, (SVCXPRT *xprt, u_long prog, u_long vers,
+ void (*dispatch)(struct svc_req *,
+ SVCXPRT*),
+ int protocol));
+
+/*
+ * Service un-registration
+ *
+ * svc_unregister(prog, vers)
+ * u_long prog;
+ * u_long vers;
+ */
+EXTERN_FUNCTION(void* svc_unregister, (u_long prog, u_long vers));
+
+/*
+ * Transport registration.
+ *
+ * xprt_register(xprt)
+ * SVCXPRT *xprt;
+ */
+EXTERN_FUNCTION(void xprt_register, (SVCXPRT* xprt));
+
+/*
+ * Transport un-register
+ *
+ * xprt_unregister(xprt)
+ * SVCXPRT *xprt;
+ */
+EXTERN_FUNCTION(void xprt_unregister, (SVCXPRT* xprt));
+
+
+
+
+/*
+ * When the service routine is called, it must first check to see if it
+ * knows about the procedure; if not, it should call svcerr_noproc
+ * and return. If so, it should deserialize its arguments via
+ * SVC_GETARGS (defined above). If the deserialization does not work,
+ * svcerr_decode should be called followed by a return. Successful
+ * decoding of the arguments should be followed the execution of the
+ * procedure's code and a call to svc_sendreply.
+ *
+ * Also, if the service refuses to execute the procedure due to too-
+ * weak authentication parameters, svcerr_weakauth should be called.
+ * Note: do not confuse access-control failure with weak authentication!
+ *
+ * NB: In pure implementations of rpc, the caller always waits for a reply
+ * msg. This message is sent when svc_sendreply is called.
+ * Therefore pure service implementations should always call
+ * svc_sendreply even if the function logically returns void; use
+ * xdr.h - xdr_void for the xdr routine. HOWEVER, tcp based rpc allows
+ * for the abuse of pure rpc via batched calling or pipelining. In the
+ * case of a batched call, svc_sendreply should NOT be called since
+ * this would send a return message, which is what batching tries to avoid.
+ * It is the service/protocol writer's responsibility to know which calls are
+ * batched and which are not. Warning: responding to batch calls may
+ * deadlock the caller and server processes!
+ */
+
+EXTERN_FUNCTION(bool_t svc_sendreply, (SVCXPRT *xprt,xdrproc_t outproc,
+ char *out));
+EXTERN_FUNCTION(void svcerr_decode, (SVCXPRT *xprt));
+EXTERN_FUNCTION(void svcerr_weakauth, (SVCXPRT *xprt));
+EXTERN_FUNCTION(void svcerr_noproc, (SVCXPRT *xprt));
+EXTERN_FUNCTION(void svcerr_progvers, (SVCXPRT *xprt));
+EXTERN_FUNCTION(void svcerr_auth, (SVCXPRT *xprt, enum auth_stat why));
+EXTERN_FUNCTION(void svcerr_noprog, (SVCXPRT *xprt));
+EXTERN_FUNCTION(void svcerr_systemerr, (SVCXPRT *xprt));
+
+/*
+ * Lowest level dispatching -OR- who owns this process anyway.
+ * Somebody has to wait for incoming requests and then call the correct
+ * service routine. The routine svc_run does infinite waiting; i.e.,
+ * svc_run never returns.
+ * Since another (co-existant) package may wish to selectively wait for
+ * incoming calls or other events outside of the rpc architecture, the
+ * routine svc_getreq is provided. It must be passed readfds, the
+ * "in-place" results of a select system call (see select, section 2).
+ */
+
+/*
+ * Global keeper of rpc service descriptors in use
+ * dynamic; must be inspected before each call to select
+ */
+#ifdef FD_SETSIZE
+extern fd_set svc_fdset;
+#define svc_fds svc_fdset.fds_bits[0] /* compatibility */
+#else
+extern int svc_fds;
+#endif /* def FD_SETSIZE */
+
+/*
+ * a small program implemented by the svc_rpc implementation itself;
+ * also see clnt.h for protocol numbers.
+ */
+EXTERN_FUNCTION(void rpctest_service, ());
+EXTERN_FUNCTION(void svc_getreq, (int rdfds));
+EXTERN_FUNCTION(void svc_getreqset, (fd_set *rdfdsp)); /* takes fdset instead of int */
+EXTERN_FUNCTION(void svc_run, ()); /* never returns */
+
+/*
+ * Socket to use on svcxxx_create call to get default socket
+ */
+#define RPC_ANYSOCK -1
+
+/*
+ * These are the existing service side transport implementations
+ */
+
+/*
+ * Memory based rpc for testing and timing.
+ */
+EXTERN_FUNCTION(SVCXPRT *svcraw_create, ());
+
+/*
+ * Udp based rpc.
+ */
+EXTERN_FUNCTION(SVCXPRT *svcudp_create, (int sock));
+EXTERN_FUNCTION(SVCXPRT *svcudp_bufcreate, (int sock, u_int sendsz,
+ u_int recvsz));
+
+/*
+ * Tcp based rpc.
+ */
+EXTERN_FUNCTION(SVCXPRT *svctcp_create, (int fd, u_int sendsz, u_int recvsz));
+
+
+
+#endif /*!_rpc_svc_h*/
diff --git a/rpc++/StdHdrs/rpc/xdr.h b/rpc++/StdHdrs/rpc/xdr.h
new file mode 100644
index 00000000000..25fb07fe68a
--- /dev/null
+++ b/rpc++/StdHdrs/rpc/xdr.h
@@ -0,0 +1,275 @@
+/* @(#)xdr.h 2.2 88/07/29 4.0 RPCSRC */
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+/* @(#)xdr.h 1.19 87/04/22 SMI */
+
+/*
+ * xdr.h, External Data Representation Serialization Routines.
+ *
+ * Copyright (C) 1984, Sun Microsystems, Inc.
+ */
+
+#ifndef _rpc_xdr_h
+#define _rpc_xdr_h
+
+#include <rpc/c_types.h>
+
+#include <rpc/types.h>
+/*
+ * XDR provides a conventional way for converting between C data
+ * types and an external bit-string representation. Library supplied
+ * routines provide for the conversion on built-in C data types. These
+ * routines and utility routines defined here are used to help implement
+ * a type encode/decode routine for each user-defined type.
+ *
+ * Each data type provides a single procedure which takes two arguments:
+ *
+ * bool_t
+ * xdrproc(xdrs, argresp)
+ * XDR *xdrs;
+ * <type> *argresp;
+ *
+ * xdrs is an instance of a XDR handle, to which or from which the data
+ * type is to be converted. argresp is a pointer to the structure to be
+ * converted. The XDR handle contains an operation field which indicates
+ * which of the operations (ENCODE, DECODE * or FREE) is to be performed.
+ *
+ * XDR_DECODE may allocate space if the pointer argresp is null. This
+ * data can be freed with the XDR_FREE operation.
+ *
+ * We write only one procedure per data type to make it easy
+ * to keep the encode and decode procedures for a data type consistent.
+ * In many cases the same code performs all operations on a user defined type,
+ * because all the hard work is done in the component type routines.
+ * decode as a series of calls on the nested data types.
+ */
+
+/*
+ * Xdr operations. XDR_ENCODE causes the type to be encoded into the
+ * stream. XDR_DECODE causes the type to be extracted from the stream.
+ * XDR_FREE can be used to release the space allocated by an XDR_DECODE
+ * request.
+ */
+enum xdr_op {
+ XDR_ENCODE=0,
+ XDR_DECODE=1,
+ XDR_FREE=2
+};
+
+/*
+ * This is the number of bytes per unit of external data.
+ */
+#define BYTES_PER_XDR_UNIT (4)
+#define RNDUP(x) ((((x) + BYTES_PER_XDR_UNIT - 1) / BYTES_PER_XDR_UNIT) \
+ * BYTES_PER_XDR_UNIT)
+
+/*
+ * The XDR handle.
+ * Contains operation which is being applied to the stream,
+ * an operations vector for the paticular implementation (e.g. see xdr_mem.c),
+ * and two private fields for the use of the particular impelementation.
+ */
+typedef struct {
+ enum xdr_op x_op; /* operation; fast additional param */
+ struct xdr_ops {
+ bool_t (*x_getlong)(); /* get a long from underlying stream */
+ bool_t (*x_putlong)(); /* put a long to " */
+ bool_t (*x_getbytes)();/* get some bytes from " */
+ bool_t (*x_putbytes)();/* put some bytes to " */
+ u_int (*x_getpostn)();/* returns bytes off from beginning */
+ bool_t (*x_setpostn)();/* lets you reposition the stream */
+ long * (*x_inline)(); /* buf quick ptr to buffered data */
+ void (*x_destroy)(); /* free privates of this xdr_stream */
+ } *x_ops;
+ caddr_t x_public; /* users' data */
+ caddr_t x_private; /* pointer to private data */
+ caddr_t x_base; /* private used for position info */
+ int x_handy; /* extra private word */
+} XDR;
+
+/*
+ * A xdrproc_t exists for each data type which is to be encoded or decoded.
+ *
+ * The second argument to the xdrproc_t is a pointer to an opaque pointer.
+ * The opaque pointer generally points to a structure of the data type
+ * to be decoded. If this pointer is 0, then the type routines should
+ * allocate dynamic storage of the appropriate size and return it.
+ * bool_t (*xdrproc_t)(XDR *, caddr_t *);
+ */
+typedef bool_t (*xdrproc_t) FUN_ARGS((XDR*, void*));
+
+/*
+ * Operations defined on a XDR handle
+ *
+ * XDR *xdrs;
+ * long *longp;
+ * caddr_t addr;
+ * u_int len;
+ * u_int pos;
+ */
+#define XDR_GETLONG(xdrs, longp) \
+ (*(xdrs)->x_ops->x_getlong)(xdrs, longp)
+#define xdr_getlong(xdrs, longp) \
+ (*(xdrs)->x_ops->x_getlong)(xdrs, longp)
+
+#define XDR_PUTLONG(xdrs, longp) \
+ (*(xdrs)->x_ops->x_putlong)(xdrs, longp)
+#define xdr_putlong(xdrs, longp) \
+ (*(xdrs)->x_ops->x_putlong)(xdrs, longp)
+
+#define XDR_GETBYTES(xdrs, addr, len) \
+ (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len)
+#define xdr_getbytes(xdrs, addr, len) \
+ (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len)
+
+#define XDR_PUTBYTES(xdrs, addr, len) \
+ (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len)
+#define xdr_putbytes(xdrs, addr, len) \
+ (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len)
+
+#define XDR_GETPOS(xdrs) \
+ (*(xdrs)->x_ops->x_getpostn)(xdrs)
+#define xdr_getpos(xdrs) \
+ (*(xdrs)->x_ops->x_getpostn)(xdrs)
+
+#define XDR_SETPOS(xdrs, pos) \
+ (*(xdrs)->x_ops->x_setpostn)(xdrs, pos)
+#define xdr_setpos(xdrs, pos) \
+ (*(xdrs)->x_ops->x_setpostn)(xdrs, pos)
+
+#define XDR_INLINE(xdrs, len) \
+ (*(xdrs)->x_ops->x_inline)(xdrs, len)
+#define xdr_inline(xdrs, len) \
+ (*(xdrs)->x_ops->x_inline)(xdrs, len)
+
+#define XDR_DESTROY(xdrs) \
+ if ((xdrs)->x_ops->x_destroy) \
+ (*(xdrs)->x_ops->x_destroy)(xdrs)
+#define xdr_destroy(xdrs) \
+ if ((xdrs)->x_ops->x_destroy) \
+ (*(xdrs)->x_ops->x_destroy)(xdrs)
+
+/*
+ * Support struct for discriminated unions.
+ * You create an array of xdrdiscrim structures, terminated with
+ * a entry with a null procedure pointer. The xdr_union routine gets
+ * the discriminant value and then searches the array of structures
+ * for a matching value. If a match is found the associated xdr routine
+ * is called to handle that part of the union. If there is
+ * no match, then a default routine may be called.
+ * If there is no match and no default routine it is an error.
+ */
+#define NULL_xdrproc_t ((xdrproc_t)0)
+struct xdr_discrim {
+ int value;
+ xdrproc_t proc;
+};
+
+/*
+ * In-line routines for fast encode/decode of primitve data types.
+ * Caveat emptor: these use single memory cycles to get the
+ * data from the underlying buffer, and will fail to operate
+ * properly if the data is not aligned. The standard way to use these
+ * is to say:
+ * if ((buf = XDR_INLINE(xdrs, count)) == NULL)
+ * return (FALSE);
+ * <<< macro calls >>>
+ * where ``count'' is the number of bytes of data occupied
+ * by the primitive data types.
+ *
+ * N.B. and frozen for all time: each data type here uses 4 bytes
+ * of external representation.
+ */
+#define IXDR_GET_LONG(buf) ((long)ntohl((u_long)*(buf)++))
+#define IXDR_PUT_LONG(buf, v) (*(buf)++ = (long)htonl((u_long)v))
+
+#define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf))
+#define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_LONG(buf))
+#define IXDR_GET_U_LONG(buf) ((u_long)IXDR_GET_LONG(buf))
+#define IXDR_GET_SHORT(buf) ((short)IXDR_GET_LONG(buf))
+#define IXDR_GET_U_SHORT(buf) ((u_short)IXDR_GET_LONG(buf))
+
+#define IXDR_PUT_BOOL(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
+#define IXDR_PUT_ENUM(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
+#define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
+#define IXDR_PUT_SHORT(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
+#define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
+
+/*
+ * These are the "generic" xdr routines.
+ */
+EXTERN_FUNCTION(bool_t xdr_void, ());
+EXTERN_FUNCTION(bool_t xdr_int, ());
+EXTERN_FUNCTION(bool_t xdr_u_int, ());
+EXTERN_FUNCTION(bool_t xdr_long, ());
+EXTERN_FUNCTION(bool_t xdr_u_long, ());
+EXTERN_FUNCTION(bool_t xdr_short, ());
+EXTERN_FUNCTION(bool_t xdr_u_short, ());
+EXTERN_FUNCTION(bool_t xdr_bool, ());
+EXTERN_FUNCTION(bool_t xdr_enum, ());
+EXTERN_FUNCTION(bool_t xdr_array, ());
+EXTERN_FUNCTION(bool_t xdr_bytes, ());
+EXTERN_FUNCTION(bool_t xdr_opaque, ());
+EXTERN_FUNCTION(bool_t xdr_string, ());
+EXTERN_FUNCTION(bool_t xdr_union, ());
+EXTERN_FUNCTION(void xdr_free, ());
+EXTERN_FUNCTION(bool_t xdr_char, ());
+EXTERN_FUNCTION(bool_t xdr_u_char, ());
+EXTERN_FUNCTION(bool_t xdr_vector, ());
+EXTERN_FUNCTION(bool_t xdr_float, ());
+EXTERN_FUNCTION(bool_t xdr_double, ());
+EXTERN_FUNCTION(bool_t xdr_reference, ());
+EXTERN_FUNCTION(bool_t xdr_pointer, ());
+EXTERN_FUNCTION(bool_t xdr_wrapstring, ());
+
+/*
+ * Common opaque bytes objects used by many rpc protocols;
+ * declared here due to commonality.
+ */
+#define MAX_NETOBJ_SZ 1024
+struct netobj {
+ u_int n_len;
+ char *n_bytes;
+};
+typedef struct netobj netobj;
+EXTERN_FUNCTION(bool_t xdr_netobj, ());
+
+/*
+ * These are the public routines for the various implementations of
+ * xdr streams.
+ */
+EXTERN_FUNCTION(void xdrmem_create, ()); /* XDR using memory buffers */
+EXTERN_FUNCTION(void xdrstdio_create, ()); /* XDR using stdio library */
+EXTERN_FUNCTION(void xdrrec_create, ()); /* XDR pseudo records for tcp */
+EXTERN_FUNCTION(bool_t xdrrec_endofrecord, ());/* make end of xdr record */
+EXTERN_FUNCTION(int xdrrec_readbytes, ()); /* like a read on a pipe */
+EXTERN_FUNCTION(bool_t xdrrec_skiprecord, ()); /* move to beginning of next record */
+EXTERN_FUNCTION(bool_t xdrrec_eof, ()); /* true if no more input */
+
+#endif /*!_rpc_xdr_h*/
diff --git a/rpc++/callback.cc b/rpc++/callback.cc
new file mode 100644
index 00000000000..1758e8a0740
--- /dev/null
+++ b/rpc++/callback.cc
@@ -0,0 +1,38 @@
+// -*- c++ -*-
+/*
+Copyright (C) 1991 Peter Bersen
+
+This file is part of the rpc++ Library. This library is free
+software; you can redistribute it and/or modify it under the terms of
+the GNU Library General Public License as published by the Free
+Software Foundation; either version 2 of the License, or (at your
+option) any later version. This library is distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even the
+implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU Library General Public License for more details.
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Modified and partially rewritten March 1992 by Michael N. Lipp,
+mnl@dtro.e-technik.th-darmstadt.de. The original copyright terms and
+conditions apply without change to any modified or new parts.
+*/
+
+static char _rpcpp_callback_cc_[]
+= "callback.cc,v 2.2 1992/06/15 19:12:37 mnl Exp";
+
+// callback.cc,v
+// Revision 2.2 1992/06/15 19:12:37 mnl
+// Fixed a few bugs, clarified interface.
+//
+// Revision 2.1.1.1 1992/03/08 13:28:42 mnl
+// Initial mnl version.
+//
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "rpc++/callback.h"
+
diff --git a/rpc++/example/Makefile b/rpc++/example/Makefile
new file mode 100644
index 00000000000..4abd7b4488f
--- /dev/null
+++ b/rpc++/example/Makefile
@@ -0,0 +1,40 @@
+TOP = ..
+SUBDIRS =
+
+CC = gcc
+CPPFLAGS = -I..
+CFLAGS = -ggdb
+C++FLAGS = $(CFLAGS)
+# for Sun:
+#LOADLIBES = -L.. -lrpc++ -lg++
+# for ISC 2.2:
+LOADLIBES = -L.. -lrpc++ -lrpclib -lmisc -lg++ -linet -liberty
+
+HDRS = calcsvc.h
+SRCS = server.cc client.cc calcsvc.cc
+
+all:: server client
+
+server: server.o calcsvc.o
+ $(CC) -o $@ server.o calcsvc.o $(LOADLIBES)
+
+client: client.o calcsvc.o
+ $(CC) -o $@ client.o calcsvc.o ../request.o $(LOADLIBES)
+
+DISTLIST = Makefile $(HDRS) $(SRCS)
+
+clean::
+ rm -f $(CLEANWILDCARDS) server client
+
+include .dependencies
+
+.dependencies: $(HDRS) $(SRCS)
+ gcc -M $(CPPFLAGS) $(SRCS) > .dependencies
+
+distlist::
+ @for f in *.[ch] *.cc; do \
+ if expr " $(DISTLIST) " : ".* $$f " >/dev/null; then : ; \
+ else echo 1>&2 "Warning: c- or h-file \"$$f\" not in DISTLIST"; fi; \
+ done
+
+include $(TOP)/Proj.make
diff --git a/rpc++/example/calcsvc.cc b/rpc++/example/calcsvc.cc
new file mode 100644
index 00000000000..6ed36594c61
--- /dev/null
+++ b/rpc++/example/calcsvc.cc
@@ -0,0 +1,30 @@
+// -*- c++ -*-
+static char _calcsvc_cc_[]
+= "calcsvc.cc,v 2.3 1992/06/15 19:13:13 mnl Exp";
+
+// calcsvc.cc,v
+// Revision 2.3 1992/06/15 19:13:13 mnl
+// Fixed a few bugs, clarified interface.
+//
+// Revision 2.2 1992/06/13 14:27:28 mnl
+// Adapted to (patched) gcc-2.2. Fixed several bugs.
+//
+// Revision 2.1.1.1 1992/03/08 13:28:45 mnl
+// Initial mnl version.
+//
+
+#include <stream.h>
+#include "calcsvc.h"
+
+XdrInfo& Xmyint = Xdr::Xint;
+
+RpcRequest CalcRequests::Add (1, &Xmyint, &Xdr::Xint, &Xdr::Xint);
+RpcRequest CalcRequests::Sub (2, &Xdr::Xint, &Xdr::Xint, &Xdr::Xint);
+RpcRequest CalcRequests::Times (3, &Xdr::Xint, &Xdr::Xint, &Xdr::Xint);
+RpcRequest CalcRequests::Div (4, &Xdr::Xint, &Xdr::Xint, &Xdr::Xint);
+RpcRequest CalcRequests::Inc (5, &Xdr::Xint, &Xdr::Xint);
+RpcRequest CalcRequests::IToA (6, &Xdr::Xwrapstring, &Xdr::Xint);
+RpcRequest CalcRequests::Reset (7, &Xdr::Xvoid);
+RpcRequest CalcRequests::Sleep (8, &Xdr::Xnull, &Xdr::Xint, RpcRequest::async);
+RpcRequest CalcRequests::Msg (9, &Xdr::Xvoid, &Xdr::Xwrapstring);
+RpcRequest CalcRequests::Invalid (100, &Xdr::Xvoid, &Xdr::Xvoid);
diff --git a/rpc++/example/calcsvc.h b/rpc++/example/calcsvc.h
new file mode 100644
index 00000000000..a70c10fadac
--- /dev/null
+++ b/rpc++/example/calcsvc.h
@@ -0,0 +1,34 @@
+// -*- c++ -*-
+#ifndef _CALCSERVICE_H_
+#define _CALCSERVICE_H_
+static char _calcsvc_h_[]
+= "calcsvc.h,v 2.3 1992/06/15 19:13:15 mnl Exp";
+
+// calcsvc.h,v
+// Revision 2.3 1992/06/15 19:13:15 mnl
+// Fixed a few bugs, clarified interface.
+//
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "rpc++/request.h"
+
+#define CALCSVC 0x20100001
+
+struct CalcRequests
+{
+ static RpcRequest Add;
+ static RpcRequest Sub;
+ static RpcRequest Times;
+ static RpcRequest Div;
+ static RpcRequest Inc;
+ static RpcRequest IToA;
+ static RpcRequest Reset; // for testing proc without args
+ static RpcRequest Sleep; // for testing async
+ static RpcRequest Msg; // for testing string passing
+ static RpcRequest Invalid; // for testing error handling
+};
+
+#endif
diff --git a/rpc++/example/client.cc b/rpc++/example/client.cc
new file mode 100644
index 00000000000..f435de61da9
--- /dev/null
+++ b/rpc++/example/client.cc
@@ -0,0 +1,64 @@
+// -*- c++ -*-
+static char _client_cc_[]
+= "client.cc,v 2.3 1992/06/15 19:13:17 mnl Exp";
+
+// client.cc,v
+// Revision 2.3 1992/06/15 19:13:17 mnl
+// Fixed a few bugs, clarified interface.
+//
+// Revision 2.2 1992/06/13 14:27:32 mnl
+// Adapted to (patched) gcc-2.2. Fixed several bugs.
+//
+// Revision 2.1.1.1 1992/03/08 13:28:45 mnl
+// Initial mnl version.
+//
+
+#include <stream.h>
+#include "rpc++/stub.h"
+
+#include "calcsvc.h"
+
+class CalcStub : public RpcStub
+{
+public:
+ inline CalcStub (u_long prognum, u_long versnum,
+ char* hostname = "localhost",
+ timeval timeout = defaultTimeout, bool connect = TRUE)
+ : RpcStub (prognum, versnum, hostname, timeout, connect) {}
+
+ inline void Reset ()
+ { Call (CalcRequests::Reset); }
+ inline int Inc (int i)
+ { return *(int*)Call (CalcRequests::Inc, &i); }
+ inline char* IToA (int i)
+ { return *(char**)Call (CalcRequests::IToA, &i); }
+ inline int Add (int s1, int s2)
+ { return *(int*)Call (CalcRequests::Add, &s1, &s2); }
+
+ inline void Msg (char* msg)
+ { Call (CalcRequests::Msg, &msg); }
+ inline void Sleep (int secs)
+ { Call (CalcRequests::Sleep, &secs); }
+};
+
+main (int argc, char* argv[])
+{
+ char* server = argv[1];
+
+ CalcStub svc (CALCSVC, 1, server);
+ svc.Reset ();
+ svc.Msg ("Hello server.\n");
+ int i = 0, o;
+ while (i < 10)
+ {
+ o = svc.Inc (i);
+ cout << svc.IToA (o) << '\n';
+ i = o;
+ }
+ i = svc.Add (12, 23);
+ cout << "add (" << 12 << ", " << 23 << ") = " << i << endl;
+ cout << "Calling Sleep (5) asynchronously.\n";
+ svc.Sleep (5);
+ cout << "Sleep call completed.\n";
+ svc.Call (CalcRequests::Invalid);
+}
diff --git a/rpc++/example/server.cc b/rpc++/example/server.cc
new file mode 100644
index 00000000000..f57496c0674
--- /dev/null
+++ b/rpc++/example/server.cc
@@ -0,0 +1,112 @@
+// -*- c++ -*-
+static char _server_cc_[]
+= "server.cc,v 2.3 1992/06/15 19:13:18 mnl Exp";
+
+// server.cc,v
+// Revision 2.3 1992/06/15 19:13:18 mnl
+// Fixed a few bugs, clarified interface.
+//
+// Revision 2.2 1992/06/13 14:27:33 mnl
+// Adapted to (patched) gcc-2.2. Fixed several bugs.
+//
+// Revision 2.1.1.1 1992/03/08 13:28:45 mnl
+// Initial mnl version.
+//
+
+#include <unistd.h>
+#include <stream.h>
+#include <string.h>
+#include <malloc.h>
+
+#include "rpc++/service.h"
+#include "calcsvc.h"
+
+class Calc
+{
+public:
+ void* Add (void*, void*);
+ void* Sub (void*, void*);
+ void* Times (void*, void*);
+ void* Div (void*, void*);
+ void* Inc (void*);
+ void* IToA (void**);
+ void Reset (RpcService*);
+};
+
+void* Calc::Add (void* in1, void* in2)
+{
+ static int res;
+ res = *(int*)in1 + *(int*)in2;
+ return &res;
+}
+
+void* Calc::Sub (void* in1, void* in2)
+{
+ static int res;
+ res = *(int*)in1 - *(int*)in2;
+ return &res;
+}
+
+void* Calc::Times (void* in1, void* in2)
+{
+ static int res;
+ res = *(int*)in1 * *(int*)in2;
+ return &res;
+}
+
+void* Calc::Div (void* in1, void* in2)
+{
+ static int res;
+ res = *(int*)in1 / *(int*)in2;
+ return &res;
+}
+
+void* Calc::Inc (void* in)
+{
+ static int res;
+ res = *(int*)in + 1;
+ return &res;
+}
+
+void* Calc::IToA (void** in)
+{
+ static char *s = 0;
+ delete s;
+ char *t = form ("%d", *(int*)in[0]);
+ s = new char[strlen (t) + 1];
+ strcpy (s, t);
+ return &s;
+}
+
+void Calc::Reset (RpcService* svc)
+{
+ cout << "Received reset from " << svc->CallerName () << ".\n";
+}
+
+void printMessage (void* in)
+{
+ cout << *(char**)in;
+}
+
+void doSleep (void* in)
+{
+ cout << form ("Sleeping %d secs.\n", *(int*)in);
+ sleep (*(int*)in);
+ cout << "Woke up.\n";
+}
+
+main ()
+{
+ RpcService svc (CALCSVC, 1);
+ Calc calc;
+ svc.Register (CalcRequests::Add, RpcMethodCall<Calc> (&calc, &calc.Add));
+ svc.Register (CalcRequests::Sub, RpcMethodCall<Calc> (&calc, &calc.Sub));
+ svc.Register (CalcRequests::Times, RpcMethodCall<Calc> (&calc, &calc.Times));
+ svc.Register (CalcRequests::Div, RpcMethodCall<Calc> (&calc, &calc.Div));
+ svc.Register (CalcRequests::Inc, RpcMethodCall<Calc> (&calc, &calc.Inc));
+ svc.Register (CalcRequests::IToA,RpcMethodCall<Calc>(&calc, &calc.IToA));
+ svc.Register (CalcRequests::Reset, RpcMethodCall<Calc> (&calc, &calc.Reset));
+ svc.Register (CalcRequests::Msg, RpcCallback (printMessage));
+ svc.Register (CalcRequests::Sleep, RpcCallback (doSleep));
+ svc.Provide ();
+}
diff --git a/rpc++/gcc-2.2.fix b/rpc++/gcc-2.2.fix
new file mode 100644
index 00000000000..f684e5b128b
--- /dev/null
+++ b/rpc++/gcc-2.2.fix
@@ -0,0 +1,252 @@
+To: bug-g++@prep.ai.mit.edu
+Subject: gcc-2.2 loops with template-local typedefs (bug&patch)
+BCC: mnl,ulf
+--text follows this line--
+Hi,
+
+trying to translate the following fragment on a Sparc running SunOs 4.1.2
+with gcc-2.2 results in gcc infinitly looping.
+
+---------------------------------------------------------------------------
+// -*- c++ -*-
+
+class AnyRpcCallback
+{
+protected:
+
+public:
+ inline virtual ~AnyRpcCallback () {}
+ inline virtual void Do (void* in, void* out) = 0;
+};
+
+template<class T> class RpcCallback : public AnyRpcCallback
+{
+ typedef void (T::*Method)(void*, void*);
+ typedef void (T::*MethodN)(void*, void**);
+ typedef void (T::*Method1)(void*, void*);
+ typedef void (T::*Method2)(void*, void*, void*);
+
+private:
+ T* object;
+ void (T::*method)(void*, void*);
+
+public:
+ inline RpcCallback (T* o, void* m)
+ { object = o; method = m; }
+ inline void Do (void* in, void* out)
+ { (object->*method)(in, out); }
+};
+
+class Test
+{
+public:
+ void m (void*, void*);
+};
+
+main ()
+{
+ Test o;
+ AnyRpcCallback* cb = new RpcCallback<Test> (&o, &Test::m);
+}
+---------------------------------------------------------------------------
+
+PLEASE NOTE that you will get another loop due to a bug that I have
+reported together with a patch earlier (it's appended to this mail).
+So you won't be able to reproduce the bug reported in this mail unless
+you have my previous patch applied. I am, however, definitely sure
+(and the explanation below will confirm it) that the bug reported in
+this mail is *NOT* caused by my patch!
+
+The problem is, that the "chain" field of the tree-nodes used by gcc
+for its internal representation is used for various purposes, and in
+the case of this template-local typedef, someone lost track of its usage.
+
+After parsing, the TYPE_DECL-node created for the typedef is appended
+to the scope via "pushlevel". Types in the current scope are linked
+using the "chain" field. At the same time, however, all components of
+the template are linked together during parsing using the same "chain"
+field. Parsing the second typedef, "pushlevel" makes the first typedef
+a successor of the second typedef and the subsequent catenation of
+components makes the second typedef a successor of the first typedef
+thus creating a loop.
+
+The resulting list of all components is used in routine
+"finish_struct".
+
+I think the most proper approach would be to use TREE_LIST nodes in
+the list of components as indirect references to the typedef-nodes.
+This is easy to achieve, it is, however, very hard to modify
+finish_struct in a way that it handles these indirection properly.
+Actually, I gave up when I tried to understand & modify the routine
+that removes the duplicate declarations from the list of components.
+
+There are two easier approaches: (1) Don't include typedefs in the
+list of components, (2) use copies of the typedef-node which have an
+unused chain field. The first approach assumes that finish_struct
+doesn't do anything with typedefs, so it wouldn't be important if they
+are missing from the list of components. If this is the case, however,
+it can't hurt to use copies of the typedef-nodes (copies of the
+originals that are linked in the scope-list), so the second approach
+is safer. It can only fail if finish_struct modifies the typedef-nodes
+and this modification is significant for the typedef-nodes in the
+scope-list (which are, of course, not modified. Only the copies are).
+
+So I think the patch is pretty safe. It fixes the problem and doesn't
+seem to introduce new ones. I'm aware that typedefs that are local to
+templates stretch language features to the limits, but it makes my
+C++ interface to RPCs real nice (I'll post it one of these days).
+
+Michael
+
+*** .orig/cp-parse.y Mon Jun 15 17:08:58 1992
+--- cp-parse.y Mon Jun 15 19:13:15 1992
+***************
+*** 2211,2217 ****
+ if (TREE_CODE (t) == ENUMERAL_TYPE && TREE_NONLOCAL_FLAG (t))
+ $$ = grok_enum_decls (t, $2);
+ else
+! $$ = $2;
+ }
+ end_exception_decls ();
+ }
+--- 2211,2233 ----
+ if (TREE_CODE (t) == ENUMERAL_TYPE && TREE_NONLOCAL_FLAG (t))
+ $$ = grok_enum_decls (t, $2);
+ else
+! {
+! /* if a component is a typedef, it is inserted
+! in the list of nodes that make up the valid
+! types in the scope. Thus its chain field is
+! used and can't be used a second time for linking
+! the components of the struct. So, we make a copy
+! here. This apparently works. The proper thing
+! to do, however, would be to use a TREE_LIST
+! node to reference the typedef. I tried to rewrite
+! finish_struct accordingly (i.e., ``dereference''
+! components TREE_LIST before use, but I gave up.
+! mnl@dtro.e-technik.th-darmstadt.de */
+! if (TREE_CODE ($2) == TYPE_DECL)
+! $$ = copy_node ($2);
+! else
+! $$ = $2;
+! }
+ }
+ end_exception_decls ();
+ }
+
+===========================================================================
+The previous bug:
+---------------------------------------------------------------------------
+Return-Path: <mnl>
+Date: Wed, 10 Jun 92 19:31:13 +0200
+From: "Michael N. Lipp" <mnl>
+To: bug-g++@prep.ai.mit.edu
+Subject: gcc-2.2 bug&patch: typedef in template
+
+Hi,
+
+gcc-2.2 on a sparc running SunOS 4.1.2 enters an infinite loop when
+compiling this:
+
+-----------------------------------------------------------------------------
+// -*- c++ -*-
+
+class AnyRpcCallback
+{
+protected:
+
+public:
+ inline virtual ~AnyRpcCallback () {}
+ inline virtual void Do (void* in, void* out) = 0;
+};
+
+template<class T> class RpcCallback : public AnyRpcCallback
+{
+ typedef void (T::*Method)(void*, void*);
+
+private:
+ T* object;
+ void (T::*method)(void*, void*);
+
+public:
+ inline RpcCallback (T* o, void* m)
+ { object = o; method = m; }
+ inline void Do (void* in, void* out)
+ { (object->*method)(in, out); }
+};
+
+class Test
+{
+public:
+ void m (void*, void*);
+};
+
+main ()
+{
+ Test o;
+ AnyRpcCallback* cb = new RpcCallback<Test> (&o, &Test::m);
+}
+-----------------------------------------------------------------------------
+
+This is quite an improvement over gcc-2.1 which dumped core with this
+source.
+
+I tracked the cause down: grokdeclarator does a pushlevel(0), then
+calls start_decl, which in turn calls grokdeclarator again which does
+a poplevel_class. This poplevel_class pops the level pushed by
+pushlevel(0) and so the poplevel performed by grokdeclarator to match
+its pushlevel(0) pops quite a different level! This can easily be
+observed by compiling cp-decl.c with -DDEBUG_CP_BINDING_LEVELS.
+
+Here is a patch that fixes the bug. I don't think it hits the real
+cause of this problem, but it works.
+
+*** .orig/cp-decl.c Wed Jun 10 14:06:26 1992
+--- cp-decl.c Wed Jun 10 15:20:38 1992
+***************
+*** 6874,6882 ****
+--- 6874,6889 ----
+ tree loc_typedecl;
+ register int i = sizeof (struct lang_decl_flags) / sizeof (int);
+ register int *pi;
++ struct binding_level *local_binding_level;
+
+ /* keep `grokdeclarator' from thinking we are in PARM context. */
+ pushlevel (0);
++ /* poplevel_class may be called by grokdeclarator which is called in
++ start_decl which is called below. In this case, our pushed level
++ may vanish and poplevel mustn't be called. So remember what we
++ have pushed and pop only if that is matched by
++ current_binding_level later. mnl@dtro.e-technik.th-darmstadt.de */
++ local_binding_level = current_binding_level;
+ loc_typedecl = start_decl (declarator, declspecs, initialized, NULL_TREE);
+
+ pi = (int *) permalloc (sizeof (struct lang_decl_flags));
+***************
+*** 6883,6889 ****
+ while (i > 0)
+ pi[--i] = 0;
+ DECL_LANG_SPECIFIC (loc_typedecl) = (struct lang_decl *) pi;
+! poplevel (0, 0, 0);
+
+ #if 0
+ if (TREE_CODE (TREE_TYPE (loc_typedecl)) == ENUMERAL_TYPE)
+--- 6890,6897 ----
+ while (i > 0)
+ pi[--i] = 0;
+ DECL_LANG_SPECIFIC (loc_typedecl) = (struct lang_decl *) pi;
+! if (current_binding_level == local_binding_level)
+! poplevel (0, 0, 0);
+
+ #if 0
+ if (TREE_CODE (TREE_TYPE (loc_typedecl)) == ENUMERAL_TYPE)
+
+Michael
+
+-----------------,------------------------------,------------------------------
+Michael N. Lipp ! Institut fuer Datentechnik ! Phone: 49-6151-163776
+ ! Merckstr. 25 ,----------' Fax: 49-6151-164976
+ ! D-6100 Darmstadt ! E-Mail:
+ ! (Germany) ! mnl@dtro.e-technik.th-darmstadt.de
+-----------------'-------------------'-----------------------------------------
+
diff --git a/rpc++/request.cc b/rpc++/request.cc
new file mode 100644
index 00000000000..c831bb531b0
--- /dev/null
+++ b/rpc++/request.cc
@@ -0,0 +1,165 @@
+// -*- c++ -*-
+/*
+Copyright (C) 1991 Peter Bersen
+
+This file is part of the rpc++ Library. This library is free
+software; you can redistribute it and/or modify it under the terms of
+the GNU Library General Public License as published by the Free
+Software Foundation; either version 2 of the License, or (at your
+option) any later version. This library is distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even the
+implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU Library General Public License for more details.
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Modified and partially rewritten March 1992 by Michael N. Lipp,
+mnl@dtro.e-technik.th-darmstadt.de. The original copyright terms and
+conditions apply without change to any modified or new parts.
+*/
+
+static char _rpcpp_request_cc_[]
+= "request.cc,v 2.3 1992/06/15 19:12:39 mnl Exp";
+
+// request.cc,v
+// Revision 2.3 1992/06/15 19:12:39 mnl
+// Fixed a few bugs, clarified interface.
+//
+// Revision 2.2 1992/06/13 14:27:01 mnl
+// Adapted to (patched) gcc-2.2. Fixed several bugs.
+//
+// Revision 2.1.1.1 1992/03/08 13:28:42 mnl
+// Initial mnl version.
+//
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "rpc++/request.h"
+
+#include <assert.h>
+
+void RpcRequest::init (u_long req, int pars, int parsz,
+ const XdrInfo* out, const XdrInfo** in, int rt)
+{
+ params = pars;
+ parmsz = parsz;
+ reqnum = req;
+ ininfo = in;
+ ininfo[params] = (XdrInfo*)0;
+ outinfo = out;
+ reqtype = rt;
+ assert (rt == normal || outinfo->Proc () == 0);
+}
+
+RpcRequest::RpcRequest(u_long req, const XdrInfo* out, int t)
+{
+ init (req, 0, 0, out, new XdrInfo*[1], t);
+}
+
+RpcRequest::RpcRequest(u_long req, const XdrInfo* out, const XdrInfo* in,
+ int t)
+{
+ const XdrInfo** a = new XdrInfo*[2];
+ a[0] = in;
+ init (req, 1, -1, out, a, t);
+}
+
+RpcRequest::RpcRequest(u_long req, const XdrInfo* out, const XdrInfo* in0,
+ const XdrInfo* in1, int t)
+{
+ const XdrInfo** a = new XdrInfo*[3];
+ a[0] = in0;
+ a[1] = in1;
+ init (req, 2, -1, out, a, t);
+}
+
+RpcRequest::RpcRequest(u_long req, const XdrInfo* out, const XdrInfo* in0,
+ const XdrInfo* in1, const XdrInfo* in2, int t)
+{
+ const XdrInfo** a = new XdrInfo*[4];
+ a[0] = in0;
+ a[1] = in1;
+ a[2] = in2;
+ init (req, 3, -1, out, a, t);
+}
+
+RpcRequest::RpcRequest(u_long req, const XdrInfo* out, const XdrInfo* in0,
+ const XdrInfo* in1, const XdrInfo* in2,
+ const XdrInfo* in3, int t)
+{
+ const XdrInfo** a = new XdrInfo*[5];
+ a[0] = in0;
+ a[1] = in1;
+ a[2] = in2;
+ a[3] = in3;
+ init (req, 4, -1, out, a, t);
+}
+
+RpcRequest::RpcRequest(u_long req, const XdrInfo* out, const XdrInfo* in0,
+ const XdrInfo* in1, const XdrInfo* in2,
+ const XdrInfo* in3, const XdrInfo* in4, int t)
+{
+ const XdrInfo** a = new XdrInfo*[6];
+ a[0] = in0;
+ a[1] = in1;
+ a[2] = in2;
+ a[3] = in3;
+ a[4] = in4;
+ init (req, 5, -1, out, a, t);
+}
+
+RpcRequest::RpcRequest(u_long req, const XdrInfo* out, const XdrInfo* in0,
+ const XdrInfo* in1, const XdrInfo* in2,
+ const XdrInfo* in3, const XdrInfo* in4,
+ const XdrInfo* in5, int t)
+{
+ const XdrInfo** a = new XdrInfo*[7];
+ a[0] = in0;
+ a[1] = in1;
+ a[2] = in2;
+ a[3] = in3;
+ a[4] = in4;
+ a[5] = in5;
+ init (req, 6, -1, out, a, t);
+}
+
+RpcRequest::RpcRequest(u_long req, const XdrInfo* out, const XdrInfo* in0,
+ const XdrInfo* in1, const XdrInfo* in2,
+ const XdrInfo* in3, const XdrInfo* in4,
+ const XdrInfo* in5, const XdrInfo *in6, int t)
+{
+ const XdrInfo** a = new XdrInfo*[8];
+ a[0] = in0;
+ a[1] = in1;
+ a[2] = in2;
+ a[3] = in3;
+ a[4] = in4;
+ a[5] = in5;
+ a[6] = in6;
+ init (req, 7, -1, out, a, t);
+}
+
+RpcRequest::RpcRequest(u_long req, const XdrInfo* out, const XdrInfo** ins,
+ int t)
+{
+ int pars = 0;
+ for (XdrInfo** p = ins; *p; p++)
+ pars += 1;
+ const XdrInfo** a = new XdrInfo* [pars + 1];
+ memcpy (a, ins, (pars + 1) * sizeof (XdrInfo*));
+ init (req, pars, -1, out, a, t);
+}
+
+int RpcRequest::ParamSize ()
+{
+ if (parmsz < 0) // not yet calculated
+ {
+ parmsz = 0;
+ for (XdrInfo** ip = ininfo; *ip; ip++)
+ parmsz += (*ip)->Size ();
+ }
+ return parmsz;
+}
diff --git a/rpc++/rpc++.cp b/rpc++/rpc++.cp
new file mode 100644
index 00000000000..38f1a39ff2d
--- /dev/null
+++ b/rpc++/rpc++.cp
@@ -0,0 +1,13 @@
+\entry {Overview}{1}{Overview}
+\entry {Installation}{2}{Installation}
+\entry {XdrInfo}{3}{\code {XdrInfo}}
+\entry {RpcRequest}{5}{\code {RpcRequest}}
+\entry {Callbacks}{7}{Callbacks}
+\entry {RpcCallback}{7}{\code {RpcCallback}}
+\entry {RpcMethodCall}{9}{\code {RpcMethodCall}}
+\entry {calling conventions}{10}{\code {calling conventions}}
+\entry {RpcService}{12}{\code {RpcService}}
+\entry {RpcStub}{16}{\code {RpcStub}}
+\entry {Caveats}{19}{Caveats}
+\entry {Global objects}{19}{Global objects}
+\entry {Destruction rules}{19}{Destruction rules}
diff --git a/rpc++/rpc++.fn b/rpc++/rpc++.fn
new file mode 100644
index 00000000000..562055e0c07
--- /dev/null
+++ b/rpc++/rpc++.fn
@@ -0,0 +1,63 @@
+\entry {XdrInfo}{3}{\code {XdrInfo}}
+\entry {Proc}{3}{\code {Proc}}
+\entry {Size}{3}{\code {Size}}
+\entry {RpcRequest}{5}{\code {RpcRequest}}
+\entry {RpcRequest}{5}{\code {RpcRequest}}
+\entry {RpcRequest}{5}{\code {RpcRequest}}
+\entry {RpcRequest}{5}{\code {RpcRequest}}
+\entry {RpcCallback}{7}{\code {RpcCallback}}
+\entry {RpcCallback}{7}{\code {RpcCallback}}
+\entry {RpcCallback}{7}{\code {RpcCallback}}
+\entry {RpcCallback}{7}{\code {RpcCallback}}
+\entry {RpcCallback}{7}{\code {RpcCallback}}
+\entry {RpcCallback}{7}{\code {RpcCallback}}
+\entry {RpcCallback}{8}{\code {RpcCallback}}
+\entry {RpcCallback}{8}{\code {RpcCallback}}
+\entry {RpcCallback}{8}{\code {RpcCallback}}
+\entry {RpcCallback}{8}{\code {RpcCallback}}
+\entry {RpcCallback}{8}{\code {RpcCallback}}
+\entry {RpcCallback}{8}{\code {RpcCallback}}
+\entry {RpcCallback}{8}{\code {RpcCallback}}
+\entry {RpcCallback}{8}{\code {RpcCallback}}
+\entry {RpcCallback}{8}{\code {RpcCallback}}
+\entry {RpcCallback}{8}{\code {RpcCallback}}
+\entry {RpcMethodCall}{9}{\code {RpcMethodCall}}
+\entry {RpcMethodCall}{9}{\code {RpcMethodCall}}
+\entry {RpcMethodCall}{9}{\code {RpcMethodCall}}
+\entry {RpcMethodCall}{9}{\code {RpcMethodCall}}
+\entry {RpcMethodCall}{9}{\code {RpcMethodCall}}
+\entry {RpcMethodCall}{9}{\code {RpcMethodCall}}
+\entry {RpcMethodCall}{9}{\code {RpcMethodCall}}
+\entry {RpcMethodCall}{9}{\code {RpcMethodCall}}
+\entry {RpcMethodCall}{9}{\code {RpcMethodCall}}
+\entry {RpcMethodCall}{9}{\code {RpcMethodCall}}
+\entry {RpcMethodCall}{9}{\code {RpcMethodCall}}
+\entry {RpcMethodCall}{10}{\code {RpcMethodCall}}
+\entry {RpcMethodCall}{10}{\code {RpcMethodCall}}
+\entry {RpcMethodCall}{10}{\code {RpcMethodCall}}
+\entry {RpcMethodCall}{10}{\code {RpcMethodCall}}
+\entry {RpcMethodCall}{10}{\code {RpcMethodCall}}
+\entry {RpcService}{12}{\code {RpcService}}
+\entry {RpcService}{12}{\code {RpcService}}
+\entry {OK}{12}{\code {OK}}
+\entry {Program}{12}{\code {Program}}
+\entry {Register}{12}{\code {Register}}
+\entry {Provide}{13}{\code {Provide}}
+\entry {HandleError}{13}{\code {HandleError}}
+\entry {Caller}{15}{\code {Caller}}
+\entry {CallerName}{15}{\code {CallerName}}
+\entry {Reply}{15}{\code {Reply}}
+\entry {Reply}{15}{\code {Reply}}
+\entry {Interrupt}{15}{\code {Interrupt}}
+\entry {RpcStub}{16}{\code {RpcStub}}
+\entry {RpcStub}{16}{\code {RpcStub}}
+\entry {Reconnect}{16}{\code {Reconnect}}
+\entry {OK}{16}{\code {OK}}
+\entry {Service}{16}{\code {Service}}
+\entry {GetTimeout}{16}{\code {GetTimeout}}
+\entry {SetTimeout}{17}{\code {SetTimeout}}
+\entry {Call}{17}{\code {Call}}
+\entry {Call}{17}{\code {Call}}
+\entry {Call}{17}{\code {Call}}
+\entry {Call}{17}{\code {Call}}
+\entry {HandleError}{17}{\code {HandleError}}
diff --git a/rpc++/rpc++.ky b/rpc++/rpc++.ky
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/rpc++/rpc++.ky
diff --git a/rpc++/rpc++.pg b/rpc++/rpc++.pg
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/rpc++/rpc++.pg
diff --git a/rpc++/rpc++.texi b/rpc++/rpc++.texi
new file mode 100644
index 00000000000..71ed33017b7
--- /dev/null
+++ b/rpc++/rpc++.texi
@@ -0,0 +1,1519 @@
+\input texinfo @c -*-texinfo-*-
+@tex
+% They are redefined in texinfo, but I need them
+\gdef\`#1{{\accent18 #1}}
+\gdef\'#1{{\accent19 #1}}
+\gdef\[{{[}}
+\gdef\]{{]}}
+@end tex
+@comment %**start of header (This is for running Texinfo on a region.)
+@setfilename rpc++.info
+@settitle A C++ Interface to Remote Procedure Calls
+@setchapternewpage on
+@comment %**end of header (This is for running Texinfo on a region.)
+
+@c You'll have to define the following additional texinfo-formats to
+@c run texinfo on this file.
+@c
+@c (put '\& 'texinfo-format 'texinfo-format-\&)
+@c (defun texinfo-format-\& ()
+@c (texinfo-discard-command)
+@c (insert "&"))
+@c
+@c (put '\[ 'texinfo-format 'texinfo-format-\[)
+@c (defun texinfo-format-\[ ()
+@c (texinfo-discard-command)
+@c (insert "["))
+@c
+@c (put '\] 'texinfo-format 'texinfo-format-\])
+@c (defun texinfo-format-\] ()
+@c (texinfo-discard-command)
+@c (insert "]"))
+
+@ifinfo
+This file documents a C++ interface to Sun remote procedure calls.
+
+Copyright @copyright{} 1992 Michael N. Lipp
+Permission is granted to make and distribute verbatim copies of
+this manual provided the copyright notice and this permission notice
+are preserved on all copies.
+
+@ignore
+Permission is granted to process this file through @TeX{} and print the
+results, provided the printed document carries copying permission
+notice identical to this one except for the removal of this paragraph
+(this paragraph not being relevant to the printed manual).
+
+@end ignore
+Permission is granted to copy and distribute modified versions of this
+manual under the conditions for verbatim copying, provided also that the
+section entitled ``GNU Library General Public License'' is included exactly as
+in the original, and provided that the entire resulting derived work is
+distributed under the terms of a permission notice identical to this one.
+
+Permission is granted to copy and distribute translations of this manual
+into another language, under the above conditions for modified versions,
+except that the section entitled ``GNU Library General Public License'' and
+this permission notice may be included in translations approved by the
+Free Software Foundation instead of in the original English.
+@end ifinfo
+
+@titlepage
+
+@title A C++ Interface
+@title to Sun Remote Procedure Calls
+@sp 1
+@subtitle @authorfont{by Michael N. Lipp}
+@sp 20
+@subtitle{for version 2.2}
+@subtitle{Technische Hochschule Darmstadt, Institut f@"ur Datentechnik}
+
+@comment The following two commands start the copyright page.
+@page
+@vskip 0pt plus 1filll
+Copyright @copyright{} 1992 Michael N. Lipp
+
+Permission is granted to make and distribute verbatim copies of
+this manual provided the copyright notice and this permission notice
+are preserved on all copies.
+
+Permission is granted to copy and distribute modified versions of this
+manual under the conditions for verbatim copying, provided also that the
+section entitled ``GNU Library General Public License'' is included exactly as
+in the original, and provided that the entire resulting derived work is
+distributed under the terms of a permission notice identical to this one.
+
+Permission is granted to copy and distribute translations of this manual
+into another language, under the above conditions for modified versions,
+except that the section entitled ``GNU Library General Public License'' may be
+included in a translation approved by the author instead of in the original
+English.
+@end titlepage
+
+@node Top, Overview, (dir), (dir)
+
+@menu
+* Overview:: Overview
+* Installation:: Installation
+* Classes:: The Classes
+* Caveats:: Caveats
+* References:: References
+* Copying:: GNU LIBRARY GENERAL PUBLIC LICENSE
+* Data Type Index:: Data Type Index
+* Function Index:: Function and Method Index
+* Concept Index:: Concept Index
+
+ --- The Detailed Node Listing ---
+
+The classes
+
+* XdrInfo:: @code{XdrInfo}
+* RpcRequest:: @code{RpcRequest}
+* Callbacks:: @code{Callbacks}
+* RpcService:: @code{RpcService}
+* RpcStub:: @code{RpcStub}
+
+Callbacks
+
+* RpcCallback:: @code{RpcCallback}
+* RpcMethodCall:: @code{RpcMethodCall}
+* Calling Conventions:: @code{Calling Conventions}
+
+Caveats
+
+* Global objects:: Global objects
+* Destruction rules:: Destruction rules
+* Matching server and clients:: Matching server and clients
+@end menu
+
+@node Overview, Installation, Top, Top
+@comment node-name, next, previous, up
+@chapter Overview
+@cindex Overview
+
+This document describes my C++ interface to Sun Remote Procedure Calls.
+It is based on sources from Peter Bersen that I got from some newsgroup,
+though I don't remember which one. I liked the basic idea but disliked
+several aspects of the interface details. So I adapted it to my likes. I
+intended some minor changes but soon found myself renaming classes,
+changing method parameters, introducing new classes, etc. The result is
+by no way compatible with the original version. It is, I hope,
+nevertheless useful.
+
+Basically, the interface defines six class: @code{XdrInfo},
+@code{RpcRequest}, @code{RpcCallback}/@code{RpcMethodCall},
+@code{RpcService} and @code{RpcStub}.
+
+@code{XdrInfo} objects describe the external data representation of a
+type. There are predefined @code{XdrInfo}s for the basic types.
+@code{RpcRequest} objects describe the available procedure calls. They
+are constructed from a unique request number, the @code{XdrInfo}s of the
+procedure's arguments and its return type. @code{RpcCallback} is an
+object that holds a pointer to a function and information about the
+number of its arguments. @code{RpcMethodCall} is a template that in a
+similar way holds a pointer to an object and one of its methods and
+Information about the number of its arguments.
+
+An @code{RpcRequest} and its matching @code{RpcCallback} or
+@code{RpcMethodCall} may be registered with an @code{RpcService}.
+Exactly one object of type @code{RpcService} may be instantiated in a
+program that implements an RPC server. Method @code{Provide ()} is a
+loop that waits for requests and dispatches them.
+
+A client program instantiates an object of type @code{RpcStub}. The
+constructor establishes a connection to the server specified by its
+arguments. Procedures of the server may be invoked using method
+@code{Call (@dots{})}.
+
+@node Installation, Classes, Overview, Top
+@comment node-name, next, previous, up
+@chapter Installation
+@cindex Installation
+
+The rpc++ library has successfully been tested using a patched gcc-2.2.2
+on a SparcStation running SunOS 4.1.[12] and a 386 system running
+Interactive Unix (a SYSV 3.2). Patching gcc-2.2.2 was necessary because
+the unpatched version can't handle typedefs that are local to templates.
+The bug report with patches can be found in the source directory in file
+@code{gcc-2.2.2.fix}.
+
+As a prerequisite to using RPCs with C++ you need ANSI-C/C++ conformant
+header files for RPC. I have provided such files in the directory
+@code{StdHdrs/rpc} of the source tree. To avoid any copyright conflicts,
+they are derived from the public available RPC source code rather than
+from the files that come with SunOS 4.1.X. The differences are minor.
+The SunOS 4.1.X files define some additional functions. You have to
+either copy the files from @code{StdHdrs/rpc} or patched files from your
+@code{/usr/include/rpc} to a directory where gcc can find them. If you
+don't want to install them globally in gcc's include directory, you can
+include them by using an additional ``@code{-I}'' flag during
+compilation.
+
+In SunOS you can simply type `@code{make install INSTROOT=@dots{}}'
+which will make the library and install it in @code{INSTROOT/lib} and
+the header files in @code{INSTROOT/include/rpc++}. Other Unices will
+probably have problems with the `install' command. Type only `make' and
+copy the resulting @code{librpc++.a} to your local library directory and
+the files @code{rpc++/*} to an @code{rpc++}-subdirectory of your local
+include directory.
+
+@node Classes, Caveats, Installation, Top
+@comment node-name, next, previous, up
+@chapter The classes
+
+@menu
+* XdrInfo:: @code{XdrInfo}
+* RpcRequest:: @code{RpcRequest}
+* Callbacks:: @code{Callbacks}
+* RpcService:: @code{RpcService}
+* RpcStub:: @code{RpcStub}
+@end menu
+
+@node XdrInfo, RpcRequest, , Classes
+@comment node-name, next, previous, up
+@section @code{XdrInfo}
+@cindex @code{XdrInfo}
+
+Declared in: @code{"rpc++/xdr++.h"}
+
+@deftp Class XdrInfo
+Class XdrInfo describes serializers. It combines the xdrproc_t with the
+size info (the size of the data to be converted) usually needed if you
+want to apply a serializer.
+@end deftp
+
+There is only one constructor for @code{XdrInfo}:
+
+@deftypefn Constructor {} XdrInfo (xdrproc_t @var{t}, size_t @var{s})
+Construct an @code{XdrInfo} for a type. The type can be converted to an
+external data representation (serielized) with function @var{t}. Its
+size (in bytes, from @code{sizeof (type)}), is @var{s}.
+@end deftypefn
+
+The methods query the information given to the constructor:
+
+@deftypefn Method xdrproc_t Proc () const
+Return the conversion function stored in an @code{XdrInfo}.
+@end deftypefn
+
+@deftypefn Method size_t Size () const
+Return the size of the type described by the @code{XdrInfo}.
+@end deftypefn
+
+There are a number of predefined @code{XdrInfo}s. They are defined as
+static members of a class @code{Xdr} for scoping reasons.
+
+@defvr XdrInfo Xdr::Xchar
+The conversion and size information for a character.
+@end defvr
+
+@defvr XdrInfo Xdr::Xshort
+The conversion and size information for a short integer.
+@end defvr
+
+@defvr XdrInfo Xdr::Xint
+The conversion and size information for an integer.
+@end defvr
+
+@defvr XdrInfo Xdr::Xlong
+The conversion and size information for a long integer.
+@end defvr
+
+@defvr XdrInfo Xdr::Xuchar
+The conversion and size information for an unsigned character.
+@end defvr
+
+@defvr XdrInfo Xdr::Xushort
+The conversion and size information for an unsigned short integer.
+@end defvr
+
+@defvr XdrInfo Xdr::Xulong
+The conversion and size information for an unsigned long integer.
+@end defvr
+
+@defvr XdrInfo Xdr::Xfloat
+The conversion and size information for a float.
+@end defvr
+
+@defvr XdrInfo Xdr::Xdouble
+The conversion and size information for a double.
+@end defvr
+
+@defvr XdrInfo Xdr::Xenum_t
+The conversion and size information for any enumeration type.
+@end defvr
+
+@defvr XdrInfo Xdr::Xbool_t
+The conversion and size information for a bool.
+@end defvr
+
+@defvr XdrInfo Xdr::Xvoid
+A special @code{XdrInfo} for the return type of a procedure that returns
+nothing.
+@end defvr
+
+@defvr XdrInfo Xdr::Xnull
+A special @code{XdrInfo} for the return type of a procedure that is to
+be executed batched or asynchronously (@pxref{RpcRequest}).
+@end defvr
+
+@page
+@node RpcRequest, Callbacks, XdrInfo, Classes
+@comment node-name, next, previous, up
+@section @code{RpcRequest}
+@cindex @code{RpcRequest}
+
+Declared in: @code{"rpc++/request.h"}
+
+@deftp Class RpcRequest
+RpcRequest is a class that specifies a request for a procedure that is
+part of (registered with) a service.
+@end deftp
+
+There are several constructors for @code{RpcRequest}. They vary in the
+number of @code{XdrInfo}s used to describe the input parameters of the
+procedure.
+
+@deftypefn Constructor {} RpcRequest (u_long @var{reqid}, const XdrInfo* @var{out}, ReqType @var{t}=normal)
+@end deftypefn
+@deftypefn Constructor {} RpcRequest (u_long @var{reqid}, const XdrInfo* @var{out}, const XdrInfo* @var{in1}, ReqType @var{t}=normal)
+@end deftypefn
+@deftypefn Constructor {} RpcRequest (u_long @var{reqid}, const XdrInfo* @var{out}, const XdrInfo* @var{in1}, const XdrInfo* @var{in2}, ReqType @var{t}=normal)
+These constructors construct an @code{RpcRequest} for a procedure with
+zero, one or two arguments. Additional similar constructors are defined
+for procedures with up to seven arguments. @var{reqid} uniquely
+identifies the request (the procedure of the server). @var{reqid} may
+not be 0. The @code{XdrInfo*}s following @var{reqid} specify the types of
+the input parameters. They are followed by the @code{XdrInfo*} that
+describes the type of the value returned by the RPC. If no value is
+returned, @code{&Xdr::Xvoid} must be given as argument
+(@pxref{XdrInfo}). The final optional argument @var{t} specifies the
+call mode: @code{RpcRequest::normal}, @code{RpcRequest::batched} or
+@code{RpcRequest::async} (see below).
+@end deftypefn
+
+@deftypefn Constructor {} RpcRequest (u_long @var{reqid}, const XdrInfo* @var{out}, const XdrInfo** @var{intypes}, ReqType @var{t}=normal)
+This constructor can be used to construct an @code{RpcRequest} with an
+arbitrary number of arguments. The pointers to @code{XdrInfo} are passed
+in an array. The number of elements in the array must be one more than
+the number of parameters and the last element must be zero.
+@end deftypefn
+
+If the request type @var{t} is @code{RpcRequest::normal}, method
+@code{Call} (@pxref{RpcStub}) assembles the message to the server, sends
+it, waits for a reply and returns the result.
+
+If the request type is @code{RpcRequest::batched}, method
+@code{RpcStub::Call} assembles the message to the server and puts it in
+a buffer. Messages are only flushed if the buffer is full or
+@code{RpcStub::Call} is used with a @code{normal} or @code{async}
+request.
+
+If the request type is @code{RpcRequest::async}, method
+@code{RpcStub::Call} (@pxref{RpcStub}) assembles the message to the
+server and sends it, as with @code{normal}. It does, however, not wait
+for a result. Mode @code{async} is implemented by calling the underlying
+RPC--function @code{clnt_call} with a timeout of zero.
+
+As in both non--normal cases (@code{batched} and @code{async})
+@code{RpcStub::Call} does not wait for a return value from the server,
+the return type of the @code{RpcRequest} must be specified as
+@code{&Xdr::Xnull}.
+
+Note that requests that are registered for a service are stored in an
+array using the request identification as the index, so keep ids small.
+
+Normally, requests should be specified in a header file included by both
+the server and the client program (@pxref{Matching server and clients}).
+
+@page
+@node Callbacks, RpcService, RpcRequest, Classes
+@comment node-name, next, previous, up
+@section Callbacks
+@cindex Callbacks
+
+If a server receives a request from a client, it needs to know how a
+particular procedure is to be invoked. This information is specified
+using objects @code{RpcCallback} or @code{RpcMethodCall} when the
+procedure resp.@ method is specified.
+
+The class
+@deftp Class AnyRpcCallback
+@end deftp
+serves as an abstract base class for the two kinds of callbacks.
+
+The following sections describe the constructors for @code{RpcCallback}
+and @code{RpcMethodCall} and the calling conventions for the functions
+or methods called back.
+
+@menu
+* RpcCallback:: @code{RpcCallback}
+* RpcMethodCall:: @code{RpcMethodCall}
+* Calling Conventions:: @code{Calling Conventions}
+@end menu
+
+@node RpcCallback, RpcMethodCall, , Callbacks
+@comment node-name, next, previous, up
+@subsection @code{RpcCallback}
+@cindex @code{RpcCallback}
+
+Declared in: @code{"rpc++/callback.h"}
+
+@deftp Class RpcCallback
+An @code{RpcCallback} describes a function that is to be called by the
+server on request from the client.
+@end deftp
+
+@deftypefn Constructor {} RpcCallback (void* (*)() @var{proc})
+@end deftypefn
+@deftypefn Constructor {} RpcCallback (void* (*)(void*) @var{proc})
+@end deftypefn
+@deftypefn Constructor {} RpcCallback (void* (*)(void*, void*) @var{proc})
+Construct an @code{RpcCallback} for a function that takes zero, one or
+two arguments and returns a result. Constructors for functions with
+up to seven arguments are defined.
+@end deftypefn
+@deftypefn Constructor {} RpcCallback (void* (*)(void**) @var{proc})
+Construct an @code{RpcCallback} for a function that takes an arbitrary
+number of arguments and returns a result.
+@end deftypefn
+
+@deftypefn Constructor {} RpcCallback (void (*)() @var{proc})
+@end deftypefn
+@deftypefn Constructor {} RpcCallback (void (*)(void*) @var{proc})
+@end deftypefn
+@deftypefn Constructor {} RpcCallback (void (*)(void*, void*) @var{proc})
+Construct an @code{RpcCallback} for a function that takes zero, one or
+two arguments and returns no result. Constructors for functions with
+up to seven arguments are defined.
+@end deftypefn
+@deftypefn Constructor {} RpcCallback (void (*)(void**) @var{proc})
+Construct an @code{RpcCallback} for a function that takes an arbitrary
+number of arguments and return no result.
+@end deftypefn
+
+@deftypefn Constructor {} RpcCallback (void* (*)(RpcService*) @var{proc})
+@end deftypefn
+@deftypefn Constructor {} RpcCallback (void* (*)(void*, RpcService*) @var{proc})
+@end deftypefn
+@deftypefn Constructor {} RpcCallback (void* (*)(void*, void*, RpcService*) @var{proc})
+Construct an @code{RpcCallback} for a function that takes zero, one or
+two arguments and returns a result. Constructors for functions with
+up to seven arguments are defined. Upon invocation, a pointer to the
+object of type @code{RpcService} that received the request and called
+the function is passed as an additional argument.
+@end deftypefn
+@deftypefn Constructor {} RpcCallback (void* (*)(void**) @var{proc})
+Construct an @code{RpcCallback} for a function that takes an arbitrary
+number of arguments and returns a result. Upon invocation, a pointer to the
+object of type @code{RpcService} that received the request and called
+the function is passed as an additional argument.
+@end deftypefn
+
+@deftypefn Constructor {} RpcCallback (void (*)(RpcService*) @var{proc})
+@end deftypefn
+@deftypefn Constructor {} RpcCallback (void (*)(void*, RpcService*) @var{proc})
+@end deftypefn
+@deftypefn Constructor {} RpcCallback (void (*)(void*, void*, RpcService*) @var{proc})
+Construct an @code{RpcCallback} for a function that takes zero, one or
+two arguments and returns a result. Constructors for functions with
+up to seven arguments are defined. Upon invocation, a pointer to the
+object of type @code{RpcService} that received the request and called
+the function is passed as an additional argument.
+@end deftypefn
+@deftypefn Constructor {} RpcCallback (void (*)(void**) @var{proc})
+Construct an @code{RpcCallback} for a function that takes an arbitrary
+number of arguments and returns a result. Upon invocation, a pointer to the
+object of type @code{RpcService} that received the request and called
+the function is passed as an additional argument.
+@end deftypefn
+
+@node RpcMethodCall, Calling Conventions, RpcCallback, Callbacks
+@comment node-name, next, previous, up
+@subsection @code{RpcMethodCall}
+@cindex @code{RpcMethodCall}
+
+Declared in: @code{"rpc++/callback.h"}
+
+@deftp Class RpcMethodCall
+An @code{RpcMethodCall} describes a method of an object that is to be
+called by the server on request from the client.
+@end deftp
+
+@deftypefn Constructor {} RpcMethodCall <class T> (void* (T::*)() @var{proc})
+@end deftypefn
+@deftypefn Constructor {} RpcMethodCall <class T> (void* (T::*)(void*) @var{proc})
+@end deftypefn
+@deftypefn Constructor {} RpcMethodCall <class T> (void* (T::*)(void*, void*) @var{proc})
+Construct an @code{RpcMethodCall} for an object and one of its methods that
+takes zero, one or two arguments and returns a result. Constructors for
+methods with up to seven arguments are defined.
+@end deftypefn
+@deftypefn Constructor {} RpcMethodCall <class T> (void* (T::*)(void**) @var{proc})
+Construct an @code{RpcMethodCall} for an object and one of its methods
+that takes an arbitrary number of arguments and returns a result.
+@end deftypefn
+
+@deftypefn Constructor {} RpcMethodCall <class T> (void (T::*)() @var{proc})
+@end deftypefn
+@deftypefn Constructor {} RpcMethodCall <class T> (void (T::*)(void*) @var{proc})
+@end deftypefn
+@deftypefn Constructor {} RpcMethodCall <class T> (void (T::*)(void*, void*) @var{proc})
+Construct an @code{RpcMethodCall} for an object and one of its methods
+that takes zero, one or two arguments and returns no result.
+Constructors for methods with up to seven arguments are defined.
+@end deftypefn
+@deftypefn Constructor {} RpcMethodCall <class T> (void (T::*)(void**) @var{proc})
+Construct an @code{RpcMethodCall} for an object and one of its methods
+that takes an arbitrary number of arguments and return no result.
+@end deftypefn
+
+@deftypefn Constructor {} RpcMethodCall <class T> (void* (T::*)(RpcService*) @var{proc})
+@end deftypefn
+@deftypefn Constructor {} RpcMethodCall <class T> (void* (T::*)(void*, RpcService*) @var{proc})
+@end deftypefn
+@deftypefn Constructor {} RpcMethodCall <class T> (void* (T::*)(void*, void*, RpcService*) @var{proc})
+Construct an @code{RpcMethodCall} for an object and one of its methods
+that takes zero, one or two arguments and returns a result. Constructors
+for methods with up to seven arguments are defined. Upon invocation, a
+pointer to the object of type @code{RpcService} that received the
+request and called the method is passed as an additional argument.
+@end deftypefn
+@deftypefn Constructor {} RpcMethodCall <class T> (void* (T::*)(void**) @var{proc})
+Construct an @code{RpcMethodCall} for an object and one of its methods
+that takes an arbitrary number of arguments and returns a result. Upon
+invocation, a pointer to the object of type @code{RpcService} that
+received the request and called the method is passed as an additional
+argument.
+@end deftypefn
+
+@deftypefn Constructor {} RpcMethodCall <class T> (void (T::*)(RpcService*) @var{proc})
+@end deftypefn
+@deftypefn Constructor {} RpcMethodCall <class T> (void (T::*)(void*, RpcService*) @var{proc})
+@end deftypefn
+@deftypefn Constructor {} RpcMethodCall <class T> (void (T::*)(void*, void*, RpcService*) @var{proc})
+Construct an @code{RpcMethodCall} for an object and one of its methods
+that takes zero, one or two arguments and returns a result. Constructors
+for methods with up to seven arguments are defined. Upon invocation, a
+pointer to the object of type @code{RpcService} that received the
+request and called the method is passed as an additional argument.
+@end deftypefn
+@deftypefn Constructor {} RpcMethodCall <class T> (void (T::*)(void**) @var{proc})
+Construct an @code{RpcMethodCall} for an object and one of its methods
+that takes an arbitrary number of arguments and returns a result. Upon
+invocation, a pointer to the object of type @code{RpcService} that
+received the request and called the method is passed as an additional
+argument.
+@end deftypefn
+
+@node Calling Conventions, , RpcMethodCall, Callbacks
+@comment node-name, next, previous, up
+@subsection @code{Calling Conventions}
+@cindex @code{calling conventions}
+
+As could be seen from the parameter types in the constructors, functions
+and methods that are called in response to a request from a client know
+only about pointers to void as arguments and result values because their
+real type is coded in the @code{RpcRequest} and not known at compile
+time. The only way to avoid this is to implement some kind of rpcgen++.
+However, I never liked this kind of tools and I'm willing to risk a bit
+of type unsafeness in this case.
+
+When a procedure (or method) is called, its arguments point to values
+(the variants with an arbitrary number of arguments receive an array of
+pointers to values) of the types specified in the constructor of the
+@code{RpcRequest} that led to the invocation of the procedure. I
+recommend to access the values and assign them to local variables of the
+procedure in the first statements. E.g.:
+@example
+void* Add (void* s1p, void* s2p)
+@{
+ int s1 = *(int*)s1p;
+ int s2 = *(int*)s2p;
+ ...
+@end example
+
+The return value of the procedure is a pointer to the result. Therefore,
+results may never be put in automatic variables. They must be global or
+static. E.g.:
+@example
+ ...
+ static int sum;
+ sum = s1 + s2;
+ return (void*)&sum;
+@}
+@end example
+
+Note the special case of strings (defined as parameters or return values
+using @code{Xdr::Xwrapstring}, @pxref{XdrInfo}). If you think of a
+string as being defined as a type ``@code{typedef char* string}'', it is
+obvious that a string is passed as argument or returned as result by a
+@code{string*}, i.e., a @code{char**}. E.g.:
+@example
+void* Capitalize (void* strp)
+@{
+ static char* str;
+ str = *(char**)strp;
+ str[0] = toupper (str[0]);
+ return (void*)&str;
+@}
+@end example
+
+@page
+@node RpcService, RpcStub, Callbacks, Classes
+@comment node-name, next, previous, up
+@section @code{RpcService}
+@cindex @code{RpcService}
+
+Declared in: @code{"rpc++/service.h"}
+
+@deftp Class RpcService
+An object of type @code{RpcService} provides the server capabilities
+within a program.
+@end deftp
+
+There are two constructors for @code{RpcService}:
+
+@deftypefn Constructor {} RpcService (u_long @var{prog}, u_long @var{vers})
+Construct an object representing the @var{vers}'th version of program
+(service) number @code{prog}.
+@end deftypefn
+@deftypefn Constructor {} RpcService (u_long @var{vers})
+Construct an object representing the @var{vers}'th version of a transient
+program (service).
+@end deftypefn
+
+@deftypefn Method bool OK ()
+Returns TRUE if the service is ready for operation, i.e., has successfully
+been established during construction.
+@end deftypefn
+
+The number of a service, especially a transient service, can be obtained
+with method @code{@w{Program ()}}:
+
+@deftypefn Method u_long Program ()
+Returns the number of the program (service). This is either the number
+passed as an argument to the constructor or a number from the transient
+program area.
+@end deftypefn
+
+The next step after the construction of an @code{RpcService} is to
+register the requests handled by the service:
+
+@deftypefn Method {virtual void} Register (const RpcRequest& @var{req}, const AnyRpcCallback& @var{cb})
+Associate request @var{req} with the procedure or object/method pair
+specified by @code{cb}. The usual way to call @code{Register} is
+@example
+@{
+ RpcService svc (...);
+ svc.register (addreq, RpcCallback (Add));
+ ...
+@}
+@end example
+@end deftypefn
+
+After all requests have been registered, the object of type
+@code{RpcService} can provide the service:
+@deftypefn Method void Provide ()
+Repeatedly wait for a request and handle it by calling the procedure or
+method registered for it.
+@end deftypefn
+
+@deftypefn Method {virtual void*} HandleError ()
+@code{HandleError} is a protected method that is called when an error
+occurs. The cause of the error is stored in a protected member variable
+@code{errorState}. If the default error handling (shown below) is not
+appropriate for your application, derive your own class from
+@code{RpcService} that implements a different error handling policy. If
+you consider an error recoverable, reset @code{errorState} to
+@code{RpcService::noError} in your error handler. Else, @code{OK ()}
+keeps returning FALSE.
+@example
+void RpcService::HandleError ()
+@{
+ switch (errorState)
+ @{
+ case reconstructionAttempt:
+ cerr << "rpc++: Attempt to construct another instance of RpcService.\n";
+ exit (1);
+ case cantCreateTCPService:
+ cerr << "rpc++: can't create tcp service.\n";
+ exit(1);
+ case cantRegisterService:
+ cerr << form ("rpc++: can't register (%d, %d, tcp).", prog, vers);
+ exit(1);
+ case cantSendReply:
+ cerr << "rpc++: can't reply to RPC call.\n";
+ break;
+ case invalidResult:
+ cerr << "rpc++: registered routine has return NULL pointer.\n";
+ abort ();
+ case notRegistered:
+ cerr << "rpc++: requested RPC routine not registered.\n";
+ break;
+ case cantGetArgs:
+ cerr << "rpc++: can't get procedure arguments.\n";
+ break;
+ case cantFreeArgs:
+ cerr << "rpc++: can't free XDR arguments.\n";
+ break;
+ @}
+ errorState = noError;
+@}
+@end example
+@end deftypefn
+
+If the program that provides the service has other things to do as well,
+i.e., does not only handle requests, it usually has its own main loop
+that handles events. This loop must be extended to handle RPC events,
+i.e., if anything happens on the RPC file descriptors, it must call
+@code{svc_getreqset} just as @code{Provide ()} does.
+@example
+void RpcService::Provide ()
+@{
+ int dtbsz = getdtablesize();
+ fd_set readfds;
+
+ for(;;)
+ @{
+ readfds = svc_fdset;
+ switch(select (dtbsz, &readfds, 0, 0, 0))
+ @{
+ case -1:
+ if (errno != EBADF)
+ continue;
+ cerr << "PRC++: select: " << sys_errlist[errno] << '\n';
+ return;
+ break;
+ case 0:
+ continue;
+ default:
+ svc_getreqset (&readfds);
+ break;
+ @}
+ @}
+@}
+@end example
+
+The following methods are only available during the execution of a
+callback, i.e., they can be applied to @code{RpcService} if a pointer to
+the invoking object has been declared as last parameter of a callback
+routine.
+
+@deftypefn Method {struct sockaddr_in*} Caller ()
+Return the socket address information of the calling host.
+@end deftypefn
+
+@deftypefn Method char* CallerName ()
+Return the name of the calling host.
+@end deftypefn
+
+@deftypefn Method void Reply ()
+@end deftypefn
+@deftypefn Method void Reply (void* @var{res})
+Normally, a request to the server terminates when the callback completes
+(either with or without returning a value, depending on the return
+type). In some cases it is desirable to reply to the client before all
+the actions related to the request have been completed. This allows the
+client to resume execution. The result (if any) must of course not
+depend on the functions still to be executed.
+@end deftypefn
+
+@deftypefn Method void Interrupt ()
+This is the proper way to terminate the loop entered by calling
+@code{Provide()}. After return from the callback that invoked
+@code{Interrupt()} method @code{Provide()} will return.
+@end deftypefn
+
+@page
+@node RpcStub, , RpcService, Classes
+@comment node-name, next, previous, up
+@section @code{RpcStub}
+@cindex @code{RpcStub}
+
+Declared in: @code{"rpc++/stub.h"}
+
+@deftp Class RpcStub
+An @code{RpcStub} represents the client side of a connection.
+@end deftp
+
+There are two constructors for @code{RpcStub} that vary in the position
+of their arguments only:
+
+@deftypefn Constructor {} RpcStub (u_long @code{prognum}, u_long @code{versnum}, char* @var{hostname}="localhost", timeval @var{timeout}=defaultTimeout, bool @var{connect}=TRUE)
+@end deftypefn
+@deftypefn Constructor {} RpcStub (u_long @code{prognum}, u_long @code{versnum}, char* @var{hostname}="localhost", bool @var{connect}=TRUE, timeval @var{timeout}=defaultTimeout)
+Construct an @code{RpcStub} that connects to the @var{versnum}'th
+version of program (service) @var{prognum} on host @var{hostname}. The
+timeout for successful completion of communication operations is
+@var{timeout} which defaults to 25 seconds. Unless @var{connect} is
+false, the constructor makes a connection attempt.
+@end deftypefn
+
+There are various methods:
+
+@deftypefn Method void Reconnect ()
+Connect to the server. Usually this method is called if the connection
+was not to be established by the constructor or if the connection
+attempt failed and is to be repeated.
+@end deftypefn
+
+@deftypefn Method bool OK ()
+Returns TRUE if the stub is ready for operation, i.e., connected to a
+server.
+@end deftypefn
+
+@deftypefn Method CLIENT* Service ()
+Access to the standard RPC level. Returns the handle that identifies the
+server.
+@end deftypefn
+
+@deftypefn Method timeval GetTimeout () const
+Returns the default timeout for network operations.
+@end deftypefn
+
+@deftypefn Method void SetTimeout (timeval& @var{timo})
+Sets the default timeout for network operations
+@end deftypefn
+
+@deftypefn Method void* Call (RpcRequest& @var{req}, bool @var{handle_errors}=TRUE)
+@end deftypefn
+@deftypefn Method void* Call (RpcRequest& @var{req}, void* @var{in1}, bool @var{handle_errors}=TRUE)
+@end deftypefn
+@deftypefn Method void* Call (RpcRequest& @var{req}, void* @var{in1}, @var{in2} bool @var{handle_errors}=TRUE)
+Request the operation specified by @var{req} from the server, passing
+zero, one or two arguments. There are declarations of this method for up
+two seven arguments. Arguments are passed as pointers to the argument
+values. The value returned by @code{Call} is a pointer to the result
+returned by the server. The result is valid until @code{Call} is called
+again. If @var{handle_errors} is FALSE and an error occurs, @code{Call}
+simply returns 0. Else, it calls method @code{HandleError} (see below).
+@end deftypefn
+@deftypefn Method void* Call (RpcRequest& @var{req}, void** @var{invals}, bool @var{handle_errors}=TRUE)
+The variant of @code{Call} that handles an arbitrary number of
+arguments. Pointers to the arguments are passed in an array in
+parameter @var{invals}. The size of the array must match the number of
+arguments given to the constructor of @var{req}.
+@end deftypefn
+
+@deftypefn Method {virtual void*} HandleError ()
+@code{HandleError} is a protected method that is called when an error
+occurs. The cause of the error is stored in a protected member variable
+@code{errorState}. If the default error handling policy (shown below) is
+not appropriate for your application, derive your own class from
+@code{RpcStub} that implements a different one. If you consider an error
+recoverable, reset @code{errorState} to @code{RpcStub::noError} in your
+error handler. Else, @code{OK ()} keeps returning FALSE. If an error
+occurs during a @code{Call} and parameter @var{handle_errors} is TRUE,
+@code{Call} invokes @code{HandleError} and returns its result as result
+of the call.
+@example
+void* RpcStub::HandleError ()
+@{
+ switch (errorState)
+ @{
+ case notConnected:
+ cerr << "rpc++: Stub has not been connected to server.\n";
+ case cantCreate:
+ cerr << clnt_spcreateerror ("rpc++") << '\n';
+ break;
+ case cantCall:
+ cerr << clnt_sperror (svc, "rpc++") << '\n';
+ exit (1);
+ @}
+ return 0;
+@}
+@end example
+@end deftypefn
+
+While no or little improvement of coding quality can be gained from
+deriving a service specific class from @code{RpcService}, the opposite
+is true for @code{RpcStub}. A service specific derivation may define
+methods that have the ``real'' argument lists instead of pointers to
+void. These methods are simply implemented by casting the arguments and
+(inline) calling one of the @code{Call}--methods. Apart from better
+type checking, this has the advantage of keeping details like the
+available @code{RpcRequest}s local to the definition of the derived
+class (see the example in the @code{example}--directory).
+
+@node Caveats, References, Classes, Top
+@comment node-name, next, previous, up
+@chapter Caveats
+@cindex Caveats
+
+@menu
+* Global objects:: Global objects
+* Destruction rules:: Destruction rules
+* Matching server and clients:: Matching server and clients
+@end menu
+
+@node Global objects, Destruction rules, , Caveats
+@comment node-name, next, previous, up
+@section Global objects
+@cindex Global objects
+
+As a general C++ rule, be careful with global objects. The sequence of
+constructor invocations for global objects is not defined. This is the
+reason, why @code{RpcRequests} are constructed from pointers to
+@code{XdrInfo}s rather than from @code{XdrInfo}s.
+
+Both @code{XdrInfo}s and @code{RpcRequest}s tend to be instantiated as
+global objects or static member variables. If the constructor of
+@code{RpcRequest} received @code{XdrInfo}s instead of pointers and
+copied the information contained in the @code{XdrInfo} (the solution I
+had preferred), it may happen that the @code{XdrInfo} has not been
+constructed yet and thus contains invalid data.
+
+The same problem occurs if you want to define a global
+``alias--@code{XdrInfo}'' matching a ``@code{typedef int myint}''.
+Don't use @code{XdrInfo Xmyint (Xdr::Xint)} as this may copy the
+uninitialized @code{Xdr::Xint}. Use @code{XdrInfo& Xmyint = Xdr::Xint}
+instead.
+
+@node Destruction rules, Matching server and clients, Global objects, Caveats
+@comment node-name, next, previous, up
+@section Destruction rules
+@cindex Destruction rules
+
+Objects of type @code{XdrInfo} are resources that can be used more than
+once, i.e., in different @code{RpcRequest}s. If they were handled
+properly, references to @code{XdrInfo} would be counted and the
+@code{XdrInfo} destructed automatically if the last reference is
+removed (unless it is the @code{XdrInfo} of a predefined type).
+
+Such a resource management for @code{XdrInfo}s has been considered
+unnecessary as @code{XdrInfo}s will rarely be dynamic objects. If the
+user allocates an @code{XdrInfo} on the stack or the heap, it is his
+responsibility to assure that the object is valid until the last
+@code{RpcResource} that uses it has been destructed.
+
+@node Matching server and clients, , Destruction rules, Caveats
+@comment node-name, next, previous, up
+@section Matching server and clients
+
+In order to make sure that the server and the clients agree about the
+protocol, all @code{RpcRequest}s for a service should be declared in a
+header file and instantiated in a corresponding source file. The header
+file and the compiled source file make the ``library'' that provides the
+service. Thus a server consists of three files: the server executable, a
+header file defining the service that is to be included in client
+sources and an object file which must be linked to the client
+executable.
+
+@c ======================================================================
+
+@node References, Copying, Caveats, Top
+@comment node-name, next, previous, up
+@unnumbered References
+
+Margaret A. Ellis, @cite{The Annotated C++ Reference Manual},
+Addison-Wesley, 1990.
+
+Stanley B. Lippmann, @cite{A C++ Primer}, Addison-Wesley, 1989.
+
+Bjarne Stroustrup, @cite{The C++ Programming Language}, Addison-Wesley,
+1986.
+
+Sun Microsystems, @cite{Network Programming}, March 1990.
+
+@c ======================================================================
+
+@node Copying, Data Type Index, References, Top
+@appendix GNU LIBRARY GENERAL PUBLIC LICENSE
+@center Version 2, June 1991
+
+@display
+Copyright @copyright{} 1991 Free Software Foundation, Inc.
+675 Mass Ave, Cambridge, MA 02139, USA
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+@end display
+
+@unnumberedsec Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software---to make sure the software is free for all its users.
+
+ This license, the Library General Public License, applies to some
+specially designated Free Software Foundation software, and to any
+other libraries whose authors decide to use it. You can use it for
+your libraries, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if
+you distribute copies of the library, or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link a program with the library, you must provide
+complete object files to the recipients so that they can relink them
+with the library, after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ Our method of protecting your rights has two steps: (1) copyright
+the library, and (2) offer you this license which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ Also, for each distributor's protection, we want to make certain
+that everyone understands that there is no warranty for this free
+library. If the library is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original
+version, so that any problems introduced by others will not reflect on
+the original authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that companies distributing free
+software will individually obtain patent licenses, thus in effect
+transforming the program into proprietary software. To prevent this,
+we have made it clear that any patent must be licensed for everyone's
+free use or not licensed at all.
+
+ Most GNU software, including some libraries, is covered by the ordinary
+GNU General Public License, which was designed for utility programs. This
+license, the GNU Library General Public License, applies to certain
+designated libraries. This license is quite different from the ordinary
+one; be sure to read it in full, and don't assume that anything in it is
+the same as in the ordinary license.
+
+ The reason we have a separate public license for some libraries is that
+they blur the distinction we usually make between modifying or adding to a
+program and simply using it. Linking a program with a library, without
+changing the library, is in some sense simply using the library, and is
+analogous to running a utility program or application program. However, in
+a textual and legal sense, the linked executable is a combined work, a
+derivative of the original library, and the ordinary General Public License
+treats it as such.
+
+ Because of this blurred distinction, using the ordinary General
+Public License for libraries did not effectively promote software
+sharing, because most developers did not use the libraries. We
+concluded that weaker conditions might promote sharing better.
+
+ However, unrestricted linking of non-free programs would deprive the
+users of those programs of all benefit from the free status of the
+libraries themselves. This Library General Public License is intended to
+permit developers of non-free programs to use free libraries, while
+preserving your freedom as a user of such programs to change the free
+libraries that are incorporated in them. (We have not seen how to achieve
+this as regards changes in header files, but we have achieved it as regards
+changes in the actual functions of the Library.) The hope is that this
+will lead to faster development of free libraries.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+``work based on the library'' and a ``work that uses the library''. The
+former contains code derived from the library, while the latter only
+works together with the library.
+
+ Note that it is possible for a library to be covered by the ordinary
+General Public License rather than by this special one.
+
+@iftex
+@unnumberedsec TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+@end iftex
+@ifinfo
+@center TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+@end ifinfo
+
+@enumerate
+@item
+This License Agreement applies to any software library which
+contains a notice placed by the copyright holder or other authorized
+party saying it may be distributed under the terms of this Library
+General Public License (also called ``this License''). Each licensee is
+addressed as ``you''.
+
+ A ``library'' means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The ``Library'', below, refers to any such software library or work
+which has been distributed under these terms. A ``work based on the
+Library'' means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term ``modification''.)
+
+ ``Source code'' for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+@item
+You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+@item
+You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+@enumerate
+@item
+The modified work must itself be a software library.
+
+@item
+You must cause the files modified to carry prominent notices
+stating that you changed the files and the date of any change.
+
+@item
+You must cause the whole of the work to be licensed at no
+charge to all third parties under the terms of this License.
+
+@item
+If a facility in the modified Library refers to a function or a
+table of data to be supplied by an application program that uses
+the facility, other than as an argument passed when the facility
+is invoked, then you must make a good faith effort to ensure that,
+in the event an application does not supply such function or
+table, the facility still operates, and performs whatever part of
+its purpose remains meaningful.
+
+(For example, a function in a library to compute square roots has
+a purpose that is entirely well-defined independent of the
+application. Therefore, Subsection 2d requires that any
+application-supplied function or table used by this function must
+be optional: if the application does not supply it, the square
+root function must still compute square roots.)
+@end enumerate
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+@item
+You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+@item
+You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+@item
+A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a ``work that uses the Library''. Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a ``work that uses the Library'' with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a ``work that uses the
+library''. The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a ``work that uses the Library'' uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+@item
+As an exception to the Sections above, you may also compile or
+link a ``work that uses the Library'' with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+@enumerate
+@item
+Accompany the work with the complete corresponding
+machine-readable source code for the Library including whatever
+changes were used in the work (which must be distributed under
+Sections 1 and 2 above); and, if the work is an executable linked
+with the Library, with the complete machine-readable ``work that
+uses the Library'', as object code and/or source code, so that the
+user can modify the Library and then relink to produce a modified
+executable containing the modified Library. (It is understood
+that the user who changes the contents of definitions files in the
+Library will not necessarily be able to recompile the application
+to use the modified definitions.)
+
+@item
+Accompany the work with a written offer, valid for at
+least three years, to give the same user the materials
+specified in Subsection 6a, above, for a charge no more
+than the cost of performing this distribution.
+
+@item
+If distribution of the work is made by offering access to copy
+from a designated place, offer equivalent access to copy the above
+specified materials from the same place.
+
+@item
+Verify that the user has already received a copy of these
+materials or that you have already sent this user a copy.
+@end enumerate
+
+ For an executable, the required form of the ``work that uses the
+Library'' must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the source code distributed need not include anything that is normally
+distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+@item
+You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+@enumerate
+@item
+Accompany the combined library with a copy of the same work
+based on the Library, uncombined with any other library
+facilities. This must be distributed under the terms of the
+Sections above.
+
+@item
+Give prominent notice with the combined library of the fact
+that part of it is a work based on the Library, and explaining
+where to find the accompanying uncombined form of the same work.
+@end enumerate
+
+@item
+You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+@item
+You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+@item
+Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+@item
+If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+@item
+If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+@item
+The Free Software Foundation may publish revised and/or new
+versions of the Library General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+``any later version'', you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+@item
+If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+@iftex
+@heading NO WARRANTY
+@end iftex
+@ifinfo
+@center NO WARRANTY
+@end ifinfo
+
+@item
+BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY ``AS IS'' WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+@item
+IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+@end enumerate
+
+@iftex
+@heading END OF TERMS AND CONDITIONS
+@end iftex
+@ifinfo
+@center END OF TERMS AND CONDITIONS
+@end ifinfo
+
+@page
+@unnumberedsec How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+``copyright'' line and a pointer to where the full notice is found.
+
+@smallexample
+@var{one line to give the library's name and a brief idea of what it does.}
+Copyright (C) @var{year} @var{name of author}
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free
+Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+@end smallexample
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a ``copyright disclaimer'' for the library, if
+necessary. Here is a sample; alter the names:
+
+@example
+Yoyodyne, Inc., hereby disclaims all copyright interest in the
+library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+@var{signature of Ty Coon}, 1 April 1990
+Ty Coon, President of Vice
+@end example
+
+That's all there is to it!
+
+@c ========================================================================
+
+@page
+@node Data Type Index, Function Index, Copying, Top
+@comment node-name, next, previous, up
+@unnumbered Data Type Index
+
+@printindex tp
+
+@node Function Index, Concept Index, Data Type Index, Top
+@comment node-name, next, previous, up
+@unnumbered Function and Method Index
+
+@printindex fn
+
+@node Concept Index, , Function Index, Top
+@comment node-name, next, previous, up
+@unnumbered Concept Index
+
+@printindex cp
+
+@contents
+@bye
diff --git a/rpc++/rpc++.toc b/rpc++/rpc++.toc
new file mode 100644
index 00000000000..95eea1fd88c
--- /dev/null
+++ b/rpc++/rpc++.toc
@@ -0,0 +1,23 @@
+\chapentry {Overview}{1}{1}
+\chapentry {Installation}{2}{2}
+\chapentry {The classes}{3}{3}
+\secentry {\code {XdrInfo}}{3}{1}{3}
+\secentry {\code {RpcRequest}}{3}{2}{5}
+\secentry {Callbacks}{3}{3}{7}
+\subsecentry {\code {RpcCallback}}{3}{3}{1}{7}
+\subsecentry {\code {RpcMethodCall}}{3}{3}{2}{9}
+\subsecentry {\code {Calling Conventions}}{3}{3}{3}{10}
+\secentry {\code {RpcService}}{3}{4}{12}
+\secentry {\code {RpcStub}}{3}{5}{16}
+\chapentry {Caveats}{4}{19}
+\secentry {Global objects}{4}{1}{19}
+\secentry {Destruction rules}{4}{2}{19}
+\secentry {Matching server and clients}{4}{3}{19}
+\unnumbchapentry {References}{21}
+\chapentry {GNU LIBRARY GENERAL PUBLIC LICENSE}{Appendix \char65}{22}
+\unnumbsecentry{Preamble}{22}
+\unnumbsecentry{TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION}{24}
+\unnumbsecentry{How to Apply These Terms to Your New Libraries}{30}
+\unnumbchapentry {Data Type Index}{31}
+\unnumbchapentry {Function and Method Index}{32}
+\unnumbchapentry {Concept Index}{33}
diff --git a/rpc++/rpc++.tp b/rpc++/rpc++.tp
new file mode 100644
index 00000000000..80265f4d91c
--- /dev/null
+++ b/rpc++/rpc++.tp
@@ -0,0 +1,7 @@
+\entry {XdrInfo}{3}{\code {XdrInfo}}
+\entry {RpcRequest}{5}{\code {RpcRequest}}
+\entry {AnyRpcCallback}{7}{\code {AnyRpcCallback}}
+\entry {RpcCallback}{7}{\code {RpcCallback}}
+\entry {RpcMethodCall}{9}{\code {RpcMethodCall}}
+\entry {RpcService}{12}{\code {RpcService}}
+\entry {RpcStub}{16}{\code {RpcStub}}
diff --git a/rpc++/rpc++.vr b/rpc++/rpc++.vr
new file mode 100644
index 00000000000..2ad8f41a633
--- /dev/null
+++ b/rpc++/rpc++.vr
@@ -0,0 +1,13 @@
+\entry {Xdr::Xchar}{3}{\code {Xdr::Xchar}}
+\entry {Xdr::Xshort}{3}{\code {Xdr::Xshort}}
+\entry {Xdr::Xint}{4}{\code {Xdr::Xint}}
+\entry {Xdr::Xlong}{4}{\code {Xdr::Xlong}}
+\entry {Xdr::Xuchar}{4}{\code {Xdr::Xuchar}}
+\entry {Xdr::Xushort}{4}{\code {Xdr::Xushort}}
+\entry {Xdr::Xulong}{4}{\code {Xdr::Xulong}}
+\entry {Xdr::Xfloat}{4}{\code {Xdr::Xfloat}}
+\entry {Xdr::Xdouble}{4}{\code {Xdr::Xdouble}}
+\entry {Xdr::Xenum{\_}t}{4}{\code {Xdr::Xenum{\_}t}}
+\entry {Xdr::Xbool{\_}t}{4}{\code {Xdr::Xbool{\_}t}}
+\entry {Xdr::Xvoid}{4}{\code {Xdr::Xvoid}}
+\entry {Xdr::Xnull}{4}{\code {Xdr::Xnull}}
diff --git a/rpc++/rpc++/callback.h b/rpc++/rpc++/callback.h
new file mode 100644
index 00000000000..6200178263f
--- /dev/null
+++ b/rpc++/rpc++/callback.h
@@ -0,0 +1,533 @@
+// -*- c++ -*-
+/*
+Copyright (C) 1991 Peter Bersen
+
+This file is part of the rpc++ Library. This library is free
+software; you can redistribute it and/or modify it under the terms of
+the GNU Library General Public License as published by the Free
+Software Foundation; either version 2 of the License, or (at your
+option) any later version. This library is distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even the
+implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU Library General Public License for more details.
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Modified and partially rewritten March 1992 by Michael N. Lipp,
+mnl@dtro.e-technik.th-darmstadt.de. The original copyright terms and
+conditions apply without change to any modified or new parts.
+*/
+
+#ifndef _RPCCALLBACK_H_
+#define _RPCCALLBACK_H_
+static char _rpcpp_callback_h_[]
+= "callback.h,v 2.3 1992/06/15 19:13:26 mnl Exp";
+
+// callback.h,v
+// Revision 2.3 1992/06/15 19:13:26 mnl
+// Fixed a few bugs, clarified interface.
+//
+// Revision 2.2 1992/06/13 14:27:37 mnl
+// Adapted to (patched) gcc-2.2. Fixed several bugs.
+//
+// Revision 2.1.1.1 1992/03/08 13:28:43 mnl
+// Initial mnl version.
+//
+
+//
+// The user interface to RpcCallback is quiet simple. The only function
+// needed is the constructor "RpcCallback (T* o, void* m)". Given a class
+// C with a method m and an object o of Type C, a callback to the method
+// can be constructed with "RpcCallback<C> (&O, &C::m)".
+// As an alternative, an RpcExtCallback may be constructed with
+// "RpcExtCallback (T* o, void* m, RpcService*)". In this case, the method
+// is called with a pointer to the RpcService object as a third argument.
+//
+// A pointer to a callback can be casted to AnyRpcCallback by
+// whatever routine receives it and the call can be made by applying "Do"
+// to the callback.
+//
+
+class RpcService;
+
+class AnyRpcCallback
+{
+ friend class RpcService;
+
+protected:
+ int params;
+ RpcService* svc;
+ virtual void* Do (void** in) = 0;
+
+public:
+ inline virtual ~AnyRpcCallback () {}
+ inline virtual AnyRpcCallback* CopyToHeap () const = 0;
+ inline int Params () const
+ { return params; }
+ inline void SetService (RpcService* s)
+ { svc = s; }
+};
+
+class RpcCallback : public AnyRpcCallback
+{
+private:
+ typedef void* (*ProcN)(void**);
+ typedef void* (*Proc0)();
+ typedef void* (*Proc1)(void*);
+ typedef void* (*Proc2)(void*, void*);
+ typedef void* (*Proc3)(void*, void*, void*);
+ typedef void* (*Proc4)(void*, void*, void*, void*);
+ typedef void* (*Proc5)(void*, void*, void*, void*, void*);
+ typedef void* (*Proc6)(void*, void*, void*, void*, void*, void*);
+ typedef void* (*Proc7)(void*, void*, void*, void*, void*, void*, void*);
+
+ typedef void (*ProcNv)(void**);
+ typedef void (*Proc0v)();
+ typedef void (*Proc1v)(void*);
+ typedef void (*Proc2v)(void*, void*);
+ typedef void (*Proc3v)(void*, void*, void*);
+ typedef void (*Proc4v)(void*, void*, void*, void*);
+ typedef void (*Proc5v)(void*, void*, void*, void*, void*);
+ typedef void (*Proc6v)(void*, void*, void*, void*, void*, void*);
+ typedef void (*Proc7v)(void*, void*, void*, void*, void*, void*, void*);
+
+ typedef void* (*ProcNs)(void**, RpcService*);
+ typedef void* (*Proc0s)(RpcService*);
+ typedef void* (*Proc1s)(void*, RpcService*);
+ typedef void* (*Proc2s)(void*, void*, RpcService*);
+ typedef void* (*Proc3s)(void*, void*, void*, RpcService*);
+ typedef void* (*Proc4s)(void*, void*, void*, void*, RpcService*);
+ typedef void* (*Proc5s)(void*, void*, void*, void*, void*, RpcService*);
+ typedef void* (*Proc6s)(void*, void*, void*, void*,
+ void*, void*, RpcService*);
+ typedef void* (*Proc7s)(void*, void*, void*, void*,
+ void*, void*, void*, RpcService*);
+
+ typedef void (*ProcNvs)(void**, RpcService*);
+ typedef void (*Proc0vs)(RpcService*);
+ typedef void (*Proc1vs)(void*, RpcService*);
+ typedef void (*Proc2vs)(void*, void*, RpcService*);
+ typedef void (*Proc3vs)(void*, void*, void*, RpcService*);
+ typedef void (*Proc4vs)(void*, void*, void*, void*, RpcService*);
+ typedef void (*Proc5vs)(void*, void*, void*, void*, void*, RpcService*);
+ typedef void (*Proc6vs)(void*, void*, void*, void*,
+ void*, void*, RpcService*);
+ typedef void (*Proc7vs)(void*, void*, void*, void*,
+ void*, void*, void*, RpcService*);
+
+ typedef void* (RpcCallback::*DoPtr)(void**);
+ DoPtr todo;
+ union
+ {
+ ProcN procN;ProcNv procNv;ProcNs procNs;ProcNvs procNvs;
+ Proc0 proc0;Proc0v proc0v;Proc0s proc0s;Proc0vs proc0vs;
+ Proc1 proc1;Proc1v proc1v;Proc1s proc1s;Proc1vs proc1vs;
+ Proc2 proc2;Proc2v proc2v;Proc2s proc2s;Proc2vs proc2vs;
+ Proc3 proc3;Proc3v proc3v;Proc3s proc3s;Proc3vs proc3vs;
+ Proc4 proc4;Proc4v proc4v;Proc4s proc4s;Proc4vs proc4vs;
+ Proc5 proc5;Proc5v proc5v;Proc5s proc5s;Proc5vs proc5vs;
+ Proc6 proc6;Proc6v proc6v;Proc6s proc6s;Proc6vs proc6vs;
+ Proc7 proc7;Proc7v proc7v;Proc7s proc7s;Proc7vs proc7vs;
+ };
+ inline RpcCallback () {}
+ inline void* Do (void** in)
+ { return (this->*todo)(in); }
+
+ inline void* DoN (void** in)
+ { return (*procN)(in); }
+ inline void* Do0 (void** in)
+ { return (*proc0)(); }
+ inline void* Do1 (void** in)
+ { return (*proc1)(in[0]); }
+ inline void* Do2 (void** in)
+ { return (*proc2)(in[0], in[1]); }
+ inline void* Do3 (void** in)
+ { return (*proc3)(in[0], in[1], in[2]); }
+ inline void* Do4 (void** in)
+ { return (*proc4)(in[0], in[1], in[2], in[3]); }
+ inline void* Do5 (void** in)
+ { return (*proc5)(in[0], in[1], in[2], in[3], in[4]); }
+ inline void* Do6 (void** in)
+ { return (*proc6)(in[0], in[1], in[2], in[3], in[4], in[5]); }
+ inline void* Do7 (void** in)
+ { return (*proc7)(in[0], in[1], in[2], in[3], in[4], in[5], in[6]); }
+ inline void* DoNv (void** in)
+ { (*procNv)(in); return (void*)0; }
+ inline void* Do0v (void** in)
+ { (*proc0v)(); return (void*)0; }
+ inline void* Do1v (void** in)
+ { (*proc1v)(in[0]); return (void*)0; }
+ inline void* Do2v (void** in)
+ { (*proc2v)(in[0], in[1]); return (void*)0; }
+ inline void* Do3v (void** in)
+ { (*proc3v)(in[0], in[1], in[2]); return (void*)0; }
+ inline void* Do4v (void** in)
+ { (*proc4v)(in[0], in[1], in[2], in[3]); return (void*)0; }
+ inline void* Do5v (void** in)
+ { (*proc5v)(in[0], in[1], in[2], in[3], in[4]); return (void*)0; }
+ inline void* Do6v (void** in)
+ { (*proc6v)(in[0], in[1], in[2], in[3], in[4], in[5]); return (void*)0; }
+ inline void* Do7v (void** in)
+ { (*proc7v)(in[0], in[1], in[2], in[3], in[4], in[5], in[6]);
+ return (void*)0; }
+
+ inline void* DoNs (void** in)
+ { return (*procNs)(in, svc); }
+ inline void* Do0s (void** in)
+ { return (*proc0s)(svc); }
+ inline void* Do1s (void** in)
+ { return (*proc1s)(in[0], svc); }
+ inline void* Do2s (void** in)
+ { return (*proc2s)(in[0], in[1], svc); }
+ inline void* Do3s (void** in)
+ { return (*proc3s)(in[0], in[1], in[2], svc); }
+ inline void* Do4s (void** in)
+ { return (*proc4s)(in[0], in[1], in[2], in[3], svc); }
+ inline void* Do5s (void** in)
+ { return (*proc5s)(in[0], in[1], in[2], in[3], in[4], svc); }
+ inline void* Do6s (void** in)
+ { return (*proc6s)(in[0], in[1], in[2], in[3], in[4], in[5], svc); }
+ inline void* Do7s (void** in)
+ { return (*proc7s)(in[0], in[1], in[2], in[3], in[4], in[5], in[6], svc); }
+ inline void* DoNvs (void** in)
+ { (*procNvs)(in, svc); return (void*)0; }
+ inline void* Do0vs (void** in)
+ { (*proc0vs)(svc); return (void*)0; }
+ inline void* Do1vs (void** in)
+ { (*proc1vs)(in[0], svc); return (void*)0; }
+ inline void* Do2vs (void** in)
+ { (*proc2vs)(in[0], in[1], svc); return (void*)0; }
+ inline void* Do3vs (void** in)
+ { (*proc3vs)(in[0], in[1], in[2], svc); return (void*)0; }
+ inline void* Do4vs (void** in)
+ { (*proc4vs)(in[0], in[1], in[2], in[3], svc); return (void*)0; }
+ inline void* Do5vs (void** in)
+ { (*proc5vs)(in[0], in[1], in[2], in[3], in[4], svc); return (void*)0; }
+ inline void* Do6vs (void** in)
+ { (*proc6vs)(in[0], in[1], in[2], in[3], in[4], in[5], svc);
+ return (void*)0; }
+ inline void* Do7vs (void** in)
+ { (*proc7vs)(in[0], in[1], in[2], in[3],
+ in[4], in[5], in[6], svc); return (void*)0; }
+
+public:
+ inline RpcCallback (ProcN p)
+ { todo = &this->DoN; procN = p; params = -1; }
+ inline RpcCallback (Proc0 p)
+ { todo = &this->Do0; proc0 = p; params = 0; }
+ inline RpcCallback (Proc1 p)
+ { todo = &this->Do1; proc1 = p; params = 1; }
+ inline RpcCallback (Proc2 p)
+ { todo = &this->Do2; proc2 = p; params = 2; }
+ inline RpcCallback (Proc3 p)
+ { todo = &this->Do3; proc3 = p; params = 3; }
+ inline RpcCallback (Proc4 p)
+ { todo = &this->Do4; proc4 = p; params = 4; }
+ inline RpcCallback (Proc5 p)
+ { todo = &this->Do5; proc5 = p; params = 5; }
+ inline RpcCallback (Proc6 p)
+ { todo = &this->Do6; proc6 = p; params = 6; }
+ inline RpcCallback (Proc7 p)
+ { todo = &this->Do7; proc7 = p; params = 7; }
+
+ inline RpcCallback (ProcNv p)
+ { todo = &this->DoNv; procNv = p; params = -1; }
+ inline RpcCallback (Proc0v p)
+ { todo = &this->Do0v; proc0v = p; params = 0; }
+ inline RpcCallback (Proc1v p)
+ { todo = &this->Do1v; proc1v = p; params = 1; }
+ inline RpcCallback (Proc2v p)
+ { todo = &this->Do2v; proc2v = p; params = 2; }
+ inline RpcCallback (Proc3v p)
+ { todo = &this->Do3v; proc3v = p; params = 3; }
+ inline RpcCallback (Proc4v p)
+ { todo = &this->Do4v; proc4v = p; params = 4; }
+ inline RpcCallback (Proc5v p)
+ { todo = &this->Do5v; proc5v = p; params = 5; }
+ inline RpcCallback (Proc6v p)
+ { todo = &this->Do6v; proc6v = p; params = 6; }
+ inline RpcCallback (Proc7v p)
+ { todo = &this->Do7v; proc7v = p; params = 7; }
+
+ inline RpcCallback (ProcNs p)
+ { todo = &this->DoNs; procNs = p; params = -1; }
+ inline RpcCallback (Proc0s p)
+ { todo = &this->Do0s; proc0s = p; params = 0; }
+ inline RpcCallback (Proc1s p)
+ { todo = &this->Do1s; proc1s = p; params = 1; }
+ inline RpcCallback (Proc2s p)
+ { todo = &this->Do2s; proc2s = p; params = 2; }
+ inline RpcCallback (Proc3s p)
+ { todo = &this->Do3s; proc3s = p; params = 3; }
+ inline RpcCallback (Proc4s p)
+ { todo = &this->Do4s; proc4s = p; params = 4; }
+ inline RpcCallback (Proc5s p)
+ { todo = &this->Do5s; proc5s = p; params = 5; }
+ inline RpcCallback (Proc6s p)
+ { todo = &this->Do6s; proc6s = p; params = 6; }
+ inline RpcCallback (Proc7s p)
+ { todo = &this->Do7s; proc7s = p; params = 7; }
+
+ inline RpcCallback (ProcNvs p)
+ { todo = &this->DoNvs; procNvs = p; params = -1; }
+ inline RpcCallback (Proc0vs p)
+ { todo = &this->Do0vs; proc0vs = p; params = 0; }
+ inline RpcCallback (Proc1vs p)
+ { todo = &this->Do1vs; proc1vs = p; params = 1; }
+ inline RpcCallback (Proc2vs p)
+ { todo = &this->Do2vs; proc2vs = p; params = 2; }
+ inline RpcCallback (Proc3vs p)
+ { todo = &this->Do3vs; proc3vs = p; params = 3; }
+ inline RpcCallback (Proc4vs p)
+ { todo = &this->Do4vs; proc4vs = p; params = 4; }
+ inline RpcCallback (Proc5vs p)
+ { todo = &this->Do5vs; proc5vs = p; params = 5; }
+ inline RpcCallback (Proc6vs p)
+ { todo = &this->Do6vs; proc6vs = p; params = 6; }
+ inline RpcCallback (Proc7vs p)
+ { todo = &this->Do7vs; proc7vs = p; params = 7; }
+
+ inline virtual AnyRpcCallback* CopyToHeap () const
+ {
+ RpcCallback* p = new RpcCallback ();
+ *p = *this;
+ return p;
+ }
+};
+
+template<class T> class RpcMethodCall : public AnyRpcCallback
+{
+private:
+ typedef void* (T::*MethodN)(void**);
+ typedef void* (T::*Method0)();
+ typedef void* (T::*Method1)(void*);
+ typedef void* (T::*Method2)(void*, void*);
+ typedef void* (T::*Method3)(void*, void*, void*);
+ typedef void* (T::*Method4)(void*, void*, void*, void*);
+ typedef void* (T::*Method5)(void*, void*, void*, void*, void*);
+ typedef void* (T::*Method6)(void*, void*, void*, void*, void*, void*);
+ typedef void* (T::*Method7)(void*, void*, void*, void*, void*, void*, void*);
+
+ typedef void (T::*MethodNv)(void**);
+ typedef void (T::*Method0v)();
+ typedef void (T::*Method1v)(void*);
+ typedef void (T::*Method2v)(void*, void*);
+ typedef void (T::*Method3v)(void*, void*, void*);
+ typedef void (T::*Method4v)(void*, void*, void*, void*);
+ typedef void (T::*Method5v)(void*, void*, void*, void*, void*);
+ typedef void (T::*Method6v)(void*, void*, void*, void*, void*, void*);
+ typedef void (T::*Method7v)(void*, void*, void*, void*, void*, void*, void*);
+
+ typedef void* (T::*MethodNs)(void**, RpcService*);
+ typedef void* (T::*Method0s)(RpcService*);
+ typedef void* (T::*Method1s)(void*, RpcService*);
+ typedef void* (T::*Method2s)(void*, void*, RpcService*);
+ typedef void* (T::*Method3s)(void*, void*, void*, RpcService*);
+ typedef void* (T::*Method4s)(void*, void*, void*, void*, RpcService*);
+ typedef void* (T::*Method5s)(void*, void*, void*, void*, void*, RpcService*);
+ typedef void* (T::*Method6s)(void*, void*, void*, void*,
+ void*, void*, RpcService*);
+ typedef void* (T::*Method7s)(void*, void*, void*, void*,
+ void*, void*, void*, RpcService*);
+
+ typedef void (T::*MethodNvs)(void**, RpcService*);
+ typedef void (T::*Method0vs)(RpcService*);
+ typedef void (T::*Method1vs)(void*, RpcService*);
+ typedef void (T::*Method2vs)(void*, void*, RpcService*);
+ typedef void (T::*Method3vs)(void*, void*, void*, RpcService*);
+ typedef void (T::*Method4vs)(void*, void*, void*, void*, RpcService*);
+ typedef void (T::*Method5vs)(void*, void*, void*, void*, void*, RpcService*);
+ typedef void (T::*Method6vs)(void*, void*, void*, void*,
+ void*, void*, RpcService*);
+ typedef void (T::*Method7vs)(void*, void*, void*, void*,
+ void*, void*, void*, RpcService*);
+
+ typedef void* (RpcMethodCall::*DoPtr)(void**);
+ DoPtr todo;
+ T* object;
+ union
+ {
+ MethodN methodN;MethodNv methodNv;MethodNs methodNs;MethodNvs methodNvs;
+ Method0 method0;Method0v method0v;Method0s method0s;Method0vs method0vs;
+ Method1 method1;Method1v method1v;Method1s method1s;Method1vs method1vs;
+ Method2 method2;Method2v method2v;Method2s method2s;Method2vs method2vs;
+ Method3 method3;Method3v method3v;Method3s method3s;Method3vs method3vs;
+ Method4 method4;Method4v method4v;Method4s method4s;Method4vs method4vs;
+ Method5 method5;Method5v method5v;Method5s method5s;Method5vs method5vs;
+ Method6 method6;Method6v method6v;Method6s method6s;Method6vs method6vs;
+ Method7 method7;Method7v method7v;Method7s method7s;Method7vs method7vs;
+ };
+ inline RpcMethodCall () {}
+ inline void* Do (void** in)
+ { return (this->*todo)(in); }
+
+ inline void* DoN (void** in)
+ { return (object->*methodN)(in); }
+ inline void* Do0 (void** in)
+ { return (object->*method0)(); }
+ inline void* Do1 (void** in)
+ { return (object->*method1)(in[0]); }
+ inline void* Do2 (void** in)
+ { return (object->*method2)(in[0], in[1]); }
+ inline void* Do3 (void** in)
+ { return (object->*method3)(in[0], in[1], in[2]); }
+ inline void* Do4 (void** in)
+ { return (object->*method4)(in[0], in[1], in[2], in[3]); }
+ inline void* Do5 (void** in)
+ { return (object->*method5)(in[0], in[1], in[2], in[3], in[4]); }
+ inline void* Do6 (void** in)
+ { return (object->*method6)(in[0], in[1], in[2], in[3], in[4], in[5]); }
+ inline void* Do7 (void** in)
+ { return (object->*method7)(in[0], in[1], in[2],
+ in[3], in[4], in[5], in[6]); }
+ inline void* DoNv (void** in)
+ { (object->*methodNv)(in); return (void*)0; }
+ inline void* Do0v (void** in)
+ { (object->*method0v)(); return (void*)0; }
+ inline void* Do1v (void** in)
+ { (object->*method1v)(in[0]); return (void*)0; }
+ inline void* Do2v (void** in)
+ { (object->*method2v)(in[0], in[1]); return (void*)0; }
+ inline void* Do3v (void** in)
+ { (object->*method3v)(in[0], in[1], in[2]); return (void*)0; }
+ inline void* Do4v (void** in)
+ { (object->*method4v)(in[0], in[1], in[2], in[3]); return (void*)0; }
+ inline void* Do5v (void** in)
+ { (object->*method5v)(in[0], in[1], in[2], in[3], in[4]);
+ return (void*)0; }
+ inline void* Do6v (void** in)
+ { (object->*method6v)(in[0], in[1], in[2], in[3], in[4], in[5]);
+ return (void*)0; }
+ inline void* Do7v (void** in)
+ { (object->*method7v)(in[0], in[1], in[2], in[3], in[4], in[5], in[6]);
+ return (void*)0; }
+
+ inline void* DoNs (void** in)
+ { return (object->*methodNs)(in, svc); }
+ inline void* Do0s (void** in)
+ { return (object->*method0s)(svc); }
+ inline void* Do1s (void** in)
+ { return (object->*method1s)(in[0], svc); }
+ inline void* Do2s (void** in)
+ { return (object->*method2s)(in[0], in[1], svc); }
+ inline void* Do3s (void** in)
+ { return (object->*method3s)(in[0], in[1], in[2], svc); }
+ inline void* Do4s (void** in)
+ { return (object->*method4s)(in[0], in[1], in[2], in[3], svc); }
+ inline void* Do5s (void** in)
+ { return (object->*method5s)(in[0], in[1], in[2], in[3], in[4], svc); }
+ inline void* Do6s (void** in)
+ { return (object->*method6s)(in[0], in[1], in[2],
+ in[3], in[4], in[5], svc); }
+ inline void* Do7s (void** in)
+ { return (object->*method7s)(in[0], in[1], in[2],
+ in[3], in[4], in[5], in[6], svc); }
+ inline void* DoNvs (void** in)
+ { (object->*methodNvs)(in, svc); return (void*)0; }
+ inline void* Do0vs (void** in)
+ { (object->*method0vs)(svc); return (void*)0; }
+ inline void* Do1vs (void** in)
+ { (object->*method1vs)(in[0], svc); return (void*)0; }
+ inline void* Do2vs (void** in)
+ { (object->*method2vs)(in[0], in[1], svc); return (void*)0; }
+ inline void* Do3vs (void** in)
+ { (object->*method3vs)(in[0], in[1], in[2], svc); return (void*)0; }
+ inline void* Do4vs (void** in)
+ { (object->*method4vs)(in[0], in[1], in[2], in[3], svc); return (void*)0; }
+ inline void* Do5vs (void** in)
+ { (object->*method5vs)(in[0], in[1], in[2], in[3], in[4], svc);
+ return (void*)0; }
+ inline void* Do6vs (void** in)
+ { (object->*method6vs)(in[0], in[1], in[2], in[3], in[4], in[5], svc);
+ return (void*)0; }
+ inline void* Do7vs (void** in)
+ { (object->*method7vs)(in[0], in[1], in[2], in[3],
+ in[4], in[5], in[6], svc); return (void*)0; }
+
+public:
+ inline RpcMethodCall (T* o, MethodN m)
+ { todo = &this->DoN; object = o; methodN = m; params = -1; }
+ inline RpcMethodCall (T* o, Method0 m)
+ { todo = &this->Do0; object = o; method0 = m; params = 0; }
+ inline RpcMethodCall (T* o, Method1 m)
+ { todo = &this->Do1; object = o; method1 = m; params = 1; }
+ inline RpcMethodCall (T* o, Method2 m)
+ { todo = &this->Do2; object = o; method2 = m; params = 2; }
+ inline RpcMethodCall (T* o, Method3 m)
+ { todo = &this->Do3; object = o; method3 = m; params = 3; }
+ inline RpcMethodCall (T* o, Method4 m)
+ { todo = &this->Do4; object = o; method4 = m; params = 4; }
+ inline RpcMethodCall (T* o, Method5 m)
+ { todo = &this->Do5; object = o; method5 = m; params = 5; }
+ inline RpcMethodCall (T* o, Method6 m)
+ { todo = &this->Do6; object = o; method6 = m; params = 6; }
+ inline RpcMethodCall (T* o, Method7 m)
+ { todo = &this->Do7; object = o; method7 = m; params = 7; }
+
+ inline RpcMethodCall (T* o, MethodNv m)
+ { todo = &this->DoNv; object = o; methodNv = m; params = -1; }
+ inline RpcMethodCall (T* o, Method0v m)
+ { todo = &this->Do0v; object = o; method0v = m; params = 0; }
+ inline RpcMethodCall (T* o, Method1v m)
+ { todo = &this->Do1v; object = o; method1v = m; params = 1; }
+ inline RpcMethodCall (T* o, Method2v m)
+ { todo = &this->Do2v; object = o; method2v = m; params = 2; }
+ inline RpcMethodCall (T* o, Method3v m)
+ { todo = &this->Do3v; object = o; method3v = m; params = 3; }
+ inline RpcMethodCall (T* o, Method4v m)
+ { todo = &this->Do4v; object = o; method4v = m; params = 4; }
+ inline RpcMethodCall (T* o, Method5v m)
+ { todo = &this->Do5v; object = o; method5v = m; params = 5; }
+ inline RpcMethodCall (T* o, Method6v m)
+ { todo = &this->Do6v; object = o; method6v = m; params = 6; }
+ inline RpcMethodCall (T* o, Method7v m)
+ { todo = &this->Do7v; object = o; method7v = m; params = 7; }
+
+ inline RpcMethodCall (T* o, MethodNs m)
+ { todo = &this->DoNs; object = o; methodNs = m; params = -1; }
+ inline RpcMethodCall (T* o, Method0s m)
+ { todo = &this->Do0s; object = o; method0s = m; params = 0; }
+ inline RpcMethodCall (T* o, Method1s m)
+ { todo = &this->Do1s; object = o; method1s = m; params = 1; }
+ inline RpcMethodCall (T* o, Method2s m)
+ { todo = &this->Do2s; object = o; method2s = m; params = 2; }
+ inline RpcMethodCall (T* o, Method3s m)
+ { todo = &this->Do3s; object = o; method3s = m; params = 3; }
+ inline RpcMethodCall (T* o, Method4s m)
+ { todo = &this->Do4s; object = o; method4s = m; params = 4; }
+ inline RpcMethodCall (T* o, Method5s m)
+ { todo = &this->Do5s; object = o; method5s = m; params = 5; }
+ inline RpcMethodCall (T* o, Method6s m)
+ { todo = &this->Do6s; object = o; method6s = m; params = 6; }
+ inline RpcMethodCall (T* o, Method7s m)
+ { todo = &this->Do7s; object = o; method7s = m; params = 7; }
+
+ inline RpcMethodCall (T* o, MethodNvs m)
+ { todo = &this->DoNvs; object = o; methodNvs = m; params = -1; }
+ inline RpcMethodCall (T* o, Method0vs m)
+ { todo = &this->Do0vs; object = o; method0vs = m; params = 0; }
+ inline RpcMethodCall (T* o, Method1vs m)
+ { todo = &this->Do1vs; object = o; method1vs = m; params = 1; }
+ inline RpcMethodCall (T* o, Method2vs m)
+ { todo = &this->Do2vs; object = o; method2vs = m; params = 2; }
+ inline RpcMethodCall (T* o, Method3vs m)
+ { todo = &this->Do3vs; object = o; method3vs = m; params = 3; }
+ inline RpcMethodCall (T* o, Method4vs m)
+ { todo = &this->Do4vs; object = o; method4vs = m; params = 4; }
+ inline RpcMethodCall (T* o, Method5vs m)
+ { todo = &this->Do5vs; object = o; method5vs = m; params = 5; }
+ inline RpcMethodCall (T* o, Method6vs m)
+ { todo = &this->Do6vs; object = o; method6vs = m; params = 6; }
+ inline RpcMethodCall (T* o, Method7vs m)
+ { todo = &this->Do7vs; object = o; method7vs = m; params = 7; }
+
+ inline virtual AnyRpcCallback* CopyToHeap () const
+ {
+ RpcMethodCall* p = new RpcMethodCall ();
+ *p = *this;
+ return p;
+ }
+};
+
+#endif
diff --git a/rpc++/rpc++/request.h b/rpc++/rpc++/request.h
new file mode 100644
index 00000000000..04250bb3105
--- /dev/null
+++ b/rpc++/rpc++/request.h
@@ -0,0 +1,121 @@
+// -*- c++ -*-
+/*
+Copyright (C) 1991 Peter Bersen
+
+This file is part of the rpc++ Library. This library is free
+software; you can redistribute it and/or modify it under the terms of
+the GNU Library General Public License as published by the Free
+Software Foundation; either version 2 of the License, or (at your
+option) any later version. This library is distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even the
+implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU Library General Public License for more details.
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Modified and partially rewritten March 1992 by Michael N. Lipp,
+mnl@dtro.e-technik.th-darmstadt.de. The original copyright terms and
+conditions apply without change to any modified or new parts.
+*/
+
+#ifndef _RPCREQUEST_H_
+#define _RPCREQUEST_H_
+static char _rpcpp_request_h_[]
+= "request.h,v 2.3 1992/06/15 19:13:28 mnl Exp";
+
+// request.h,v
+// Revision 2.3 1992/06/15 19:13:28 mnl
+// Fixed a few bugs, clarified interface.
+//
+// Revision 2.2 1992/06/13 14:27:39 mnl
+// Adapted to (patched) gcc-2.2. Fixed several bugs.
+//
+// Revision 2.1.1.1 1992/03/08 13:28:43 mnl
+// Initial mnl version.
+//
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "xdr++.h"
+
+// RpcRequest is a class that specifies an individual request that is
+// part of a service. Three parameters are required to specify a request:
+// - the request number
+// - the serializer (XdrInfo) for the input to the request
+// - the serializer (XdrInfo) for the output from the request
+class RpcRequest
+{
+private:
+ void init (u_long req, int pars, int parsz,
+ const XdrInfo* out, const XdrInfo** in, int rt);
+
+public:
+ // Construct a new request from a request id, the information about
+ // the input data and the information about the output data.
+ // Note that requests that are registered for a service are stored
+ // in an array using the request id as the index, so keep indices
+ // small.
+ typedef enum { normal, batched, async } ReqType;
+ // No input arg:
+ RpcRequest (u_long req, const XdrInfo* out, int t = normal);
+ // One input arg:
+ RpcRequest (u_long req, const XdrInfo* out, const XdrInfo* in,
+ int t = normal);
+ // Two input args:
+ RpcRequest (u_long req, const XdrInfo* out, const XdrInfo*, const XdrInfo*,
+ int t = normal);
+ // ...
+ RpcRequest (u_long req, const XdrInfo* out, const XdrInfo*, const XdrInfo*,
+ const XdrInfo*, int t = normal);
+ RpcRequest (u_long req, const XdrInfo* out, const XdrInfo*, const XdrInfo*,
+ const XdrInfo*, const XdrInfo*, int t = normal);
+ RpcRequest (u_long req, const XdrInfo* out, const XdrInfo*, const XdrInfo*,
+ const XdrInfo*, const XdrInfo*, const XdrInfo*, int t = normal);
+ RpcRequest (u_long req, const XdrInfo* out, const XdrInfo*, const XdrInfo*,
+ const XdrInfo*, const XdrInfo*, const XdrInfo*, const XdrInfo*,
+ int t = normal);
+ RpcRequest (u_long req, const XdrInfo* out, const XdrInfo*, const XdrInfo*,
+ const XdrInfo*, const XdrInfo*, const XdrInfo*, const XdrInfo*,
+ const XdrInfo*, int t = normal);
+ // N input args, conversion routines given as a NULL terminated array
+ // of XdrInfo*:
+ RpcRequest (u_long req, const XdrInfo* out, const XdrInfo**, int t = normal);
+ ~RpcRequest ();
+ int RequestNumber () const;
+ const XdrInfo** InInfo ();
+ const XdrInfo* OutInfo ();
+ ReqType Type ();
+ int Params () const;
+ int ParamSize ();
+
+protected:
+ int params;
+ int parmsz;
+ u_long reqnum;
+ const XdrInfo** ininfo;
+ const XdrInfo* outinfo;
+ ReqType reqtype;
+};
+
+inline RpcRequest::~RpcRequest ()
+{ delete [] ininfo; }
+
+inline int RpcRequest::Params () const
+{ return params; }
+
+inline int RpcRequest::RequestNumber () const
+{ return reqnum; }
+
+inline const XdrInfo** RpcRequest::InInfo ()
+{ return ininfo; }
+
+inline const XdrInfo* RpcRequest::OutInfo ()
+{ return outinfo; }
+
+inline RpcRequest::ReqType RpcRequest::Type ()
+{ return reqtype; }
+
+#endif
diff --git a/rpc++/rpc++/service.h b/rpc++/rpc++/service.h
new file mode 100644
index 00000000000..327c965ced3
--- /dev/null
+++ b/rpc++/rpc++/service.h
@@ -0,0 +1,132 @@
+// -*- c++ -*-
+/*
+Copyright (C) 1991 Peter Bersen
+
+This file is part of the rpc++ Library. This library is free
+software; you can redistribute it and/or modify it under the terms of
+the GNU Library General Public License as published by the Free
+Software Foundation; either version 2 of the License, or (at your
+option) any later version. This library is distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even the
+implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU Library General Public License for more details.
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Modified and partially rewritten March 1992 by Michael N. Lipp,
+mnl@dtro.e-technik.th-darmstadt.de. The original copyright terms and
+conditions apply without change to any modified or new parts.
+*/
+
+#ifndef _RPCSERVICE_H_
+#define _RPCSERVICE_H_
+static char _rpcpp_service_h_[]
+= "service.h,v 2.3 1992/06/15 19:13:30 mnl Exp";
+
+// service.h,v
+// Revision 2.3 1992/06/15 19:13:30 mnl
+// Fixed a few bugs, clarified interface.
+//
+// Revision 2.2 1992/06/13 14:27:41 mnl
+// Adapted to (patched) gcc-2.2. Fixed several bugs.
+//
+// Revision 2.1.1.1 1992/03/08 13:28:43 mnl
+// Initial mnl version.
+//
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#undef TRUE
+#undef FALSE
+#include <bool.h>
+#include "request.h"
+#include "callback.h"
+
+class RpcRegistered;
+
+class RpcService
+{
+public:
+ typedef enum
+ { noError, reconstructionAttempt, cantCreateTCPService,
+ cantRegisterService, notRegistered, cantGetArgs,
+ invalidResult, cantSendReply, cantFreeArgs, selectError,
+ } errorCode;
+
+ // Get state
+ inline virtual bool OK ()
+ { return errorState == noError; }
+ // Construct a service object for service prog, version vers
+ RpcService (u_long prog, u_long vers);
+ // Construct a transient service object for version vers
+ RpcService (u_long vers);
+ // Destruct the service
+ virtual ~RpcService ();
+
+ // Get the program number (normally used after construction of transient)
+ u_long Program ();
+
+ // Register an object and its method to be called on request
+ virtual void Register (const RpcRequest&, const AnyRpcCallback&);
+
+ // The link to RPC
+ virtual void Dispatch (svc_req* req, SVCXPRT* transp);
+ // Provide the service. Never returns.
+ void Provide ();
+
+ // Get caller. May be called during execution of a service routine.
+ inline struct sockaddr_in* Caller ()
+ { return svc_getcaller (xprt); }
+ char* CallerName ();
+ // Reply before return
+ void Reply (void* res);
+ void Reply ();
+ // Quit provide loop
+ void Interrupt ();
+
+private:
+ // Save the address of the one and only RpcService in the process.
+ // There may be only one RpcService, because we can register a program
+ // with svc_register (method RpcServiceCallback) but we can't make
+ // the svc function give an argument to this function when doing a
+ // callback, which means that we can't have it distinguish between
+ // various instances of RpcService.
+ static RpcService* me;
+ static inline void RpcServiceCallback (svc_req* req, SVCXPRT* transp)
+ { RpcService::me->Dispatch (req, transp); }
+
+protected:
+ void init ();
+ void HandleError (errorCode e);
+ errorCode errorState;
+ u_long prog;
+ u_long vers;
+ RpcRegistered** handlers;
+ int maxHandlerIndex;
+ SVCXPRT* xprt;
+ RpcRequest* rpcreq;
+ bool quitLoop;
+ char* inbuf;
+ int inmax;
+ bool haveReplied;
+
+ // Default error handling prints a message and exit(2)s.
+ virtual void HandleError ();
+};
+
+inline void RpcService::HandleError (errorCode e)
+{ errorState = e; HandleError (); }
+
+inline u_long RpcService::Program ()
+{ return prog; }
+
+inline void RpcService::Reply ()
+{ Reply (0); }
+
+inline void RpcService::Interrupt ()
+{ quitLoop = TRUE; }
+
+#endif
diff --git a/rpc++/rpc++/stub.h b/rpc++/rpc++/stub.h
new file mode 100644
index 00000000000..22d467f2441
--- /dev/null
+++ b/rpc++/rpc++/stub.h
@@ -0,0 +1,145 @@
+// -*- c++ -*-
+/*
+Copyright (C) 1991 Peter Bersen
+
+This file is part of the rpc++ Library. This library is free
+software; you can redistribute it and/or modify it under the terms of
+the GNU Library General Public License as published by the Free
+Software Foundation; either version 2 of the License, or (at your
+option) any later version. This library is distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even the
+implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU Library General Public License for more details.
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Modified and partially rewritten March 1992 by Michael N. Lipp,
+mnl@dtro.e-technik.th-darmstadt.de. The original copyright terms and
+conditions apply without change to any modified or new parts.
+*/
+
+#ifndef _RPCSTUB_H_
+#define _RPCSTUB_H_
+static char _rpcpp_stub_h_[]
+= "stub.h,v 2.3 1992/06/15 19:13:31 mnl Exp";
+
+// stub.h,v
+// Revision 2.3 1992/06/15 19:13:31 mnl
+// Fixed a few bugs, clarified interface.
+//
+// Revision 2.2 1992/06/13 14:27:43 mnl
+// Adapted to (patched) gcc-2.2. Fixed several bugs.
+//
+// Revision 2.1.1.1 1992/03/08 13:28:43 mnl
+// Initial mnl version.
+//
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#undef TRUE
+#undef FALSE
+#include <bool.h>
+#include <String.h>
+#include <sys/time.h>
+#include "request.h"
+
+class RpcStub
+{
+protected:
+ static timeval defaultTimeout;
+ static void* res;
+ static size_t resmax;
+ static xdrproc_t resproc;
+ void init (u_long prognum, u_long versnum,
+ char* hostname, timeval timeout, bool connect);
+
+public:
+ typedef enum
+ { noError, notConnected, cantCreate, cantCall,
+ } errorCode;
+
+ // Construct a new stub
+ RpcStub (u_long prognum, u_long versnum,
+ char* hostname = "localhost",
+ timeval timeout = defaultTimeout, bool connect = TRUE);
+ RpcStub (u_long prognum, u_long versnum,
+ char* hostname = "localhost",
+ bool connect = TRUE, timeval timeout = defaultTimeout);
+ virtual ~RpcStub ();
+
+ // Reconnect (in case of failure or delayed connection)
+ void Reconnect ();
+
+ // Various inquiries
+ virtual bool OK ();
+ CLIENT* Service ();
+
+ // Get/set timeout
+ timeval GetTimeout () const;
+ void SetTimeout (timeval& timo);
+
+ // Make a call, either with or without an argument. If handle_errors
+ // is true, "Call" will call the error handler in case of an error.
+ // Else, it returns 0 as result and it is up to the client to handle
+ // the error.
+ // Call with one arg:
+ void* Call (RpcRequest&, bool handle_errors = TRUE);
+ // Call with two args:
+ void* Call (RpcRequest&, void* in, bool handle_errors = TRUE);
+ // ...
+ void* Call (RpcRequest& req, void*, void*, bool handle_errors = TRUE);
+ void* Call (RpcRequest& req, void*, void*, void*, bool handle_errors = TRUE);
+ void* Call (RpcRequest& req, void*, void*, void*, void*,
+ bool handle_errors = TRUE);
+ void* Call (RpcRequest& req, void*, void*, void*, void*, void*,
+ bool handle_errors = TRUE);
+ void* Call (RpcRequest& req, void*, void*, void*, void*, void*, void*,
+ bool handle_errors = TRUE);
+ void* Call (RpcRequest& req, void*, void*, void*, void*, void*, void*, void*,
+ bool handle_errors = TRUE);
+ // Call with N args:
+ void* Call (RpcRequest& req, void**, bool handle_errors = TRUE);
+
+protected:
+ void* HandleError (errorCode e);
+ errorCode errorState;
+ u_long program;
+ u_long version;
+ String server;
+ timeval timeout;
+ CLIENT* svc;
+ // Default error handling prints a message and exit(2)s.
+ virtual void* HandleError ();
+ void* DoCall (RpcRequest& req, void** args, bool handle_errors);
+};
+
+inline RpcStub::RpcStub (u_long prognum, u_long versnum,
+ char* hostname, timeval timeout, bool connect)
+{ init (prognum, versnum, hostname, timeout, connect); }
+
+inline RpcStub::RpcStub (u_long prognum, u_long versnum,
+ char* hostname, bool connect, timeval timeout)
+{ init (prognum, versnum, hostname, timeout, connect); }
+
+inline virtual bool RpcStub::OK ()
+{ return errorState == noError; }
+
+inline CLIENT* RpcStub::Service ()
+{ return svc; }
+
+inline timeval RpcStub::GetTimeout () const
+{ return timeout; }
+
+inline void RpcStub::SetTimeout (timeval& timo)
+{ timeout = timo; }
+
+inline void* RpcStub::Call (RpcRequest& req, bool handle_errors = TRUE)
+{ return Call (req, (void*)0, handle_errors); }
+
+inline void* RpcStub::HandleError (errorCode e)
+{ errorState = e; return HandleError (); }
+
+#endif
diff --git a/rpc++/rpc++/xdr++.h b/rpc++/rpc++/xdr++.h
new file mode 100644
index 00000000000..72da1cb1d4c
--- /dev/null
+++ b/rpc++/rpc++/xdr++.h
@@ -0,0 +1,98 @@
+// -*- c++ -*-
+/*
+Copyright (C) 1991 Peter Bersen
+
+This file is part of the rpc++ Library. This library is free
+software; you can redistribute it and/or modify it under the terms of
+the GNU Library General Public License as published by the Free
+Software Foundation; either version 2 of the License, or (at your
+option) any later version. This library is distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even the
+implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU Library General Public License for more details.
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Modified and partially rewritten March 1992 by Michael N. Lipp,
+mnl@dtro.e-technik.th-darmstadt.de. The original copyright terms and
+conditions apply without change to any modified or new parts.
+*/
+
+#ifndef _XDRPLPL_H_
+#define _XDRPLPL_H_
+static char _rpcpp_xdrpp_h_[]
+= "xdr++.h,v 2.3 1992/06/15 19:13:33 mnl Exp";
+
+// xdr++.h,v
+// Revision 2.3 1992/06/15 19:13:33 mnl
+// Fixed a few bugs, clarified interface.
+//
+// Revision 2.2 1992/06/13 14:27:44 mnl
+// Adapted to (patched) gcc-2.2. Fixed several bugs.
+//
+// Revision 2.1.1.1 1992/03/08 13:28:43 mnl
+// Initial mnl version.
+//
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+/*
+** Class XdrInfo describes serializers. It combines the xdrproc_t with the
+** size info usually needed if you want to apply a serializer.
+*/
+
+#include <rpc/rpc.h>
+
+class XdrInfo
+{
+protected:
+ xdrproc_t proc;
+ size_t size;
+public:
+ inline XdrInfo (xdrproc_t p, size_t s)
+ { proc = p; size = s; }
+ inline xdrproc_t Proc () const
+ { return proc; }
+ inline size_t Size () const
+ { return size; }
+};
+
+struct XdrSeqInfo
+{
+ XdrInfo** infos;
+ void** data;
+};
+
+/*
+** Class Xdr provides a unique (C++-like) name scope for the predefined
+** xdr routines by defining them as static members of type XdrInfo.
+*/
+
+class Xdr
+{
+public:
+ static XdrInfo Xnull;
+ static XdrInfo Xchar;
+ static XdrInfo Xshort;
+ static XdrInfo Xint;
+ static XdrInfo Xlong;
+ static XdrInfo Xuchar;
+ static XdrInfo Xushort;
+ static XdrInfo Xuint;
+ static XdrInfo Xulong;
+ static XdrInfo Xfloat;
+ static XdrInfo Xdouble;
+
+ static XdrInfo Xenum_t;
+ static XdrInfo Xbool_t;
+ static XdrInfo Xvoid;
+
+ static XdrInfo Xwrapstring;
+
+ static bool_t XdrParams (XDR* xdrs, XdrSeqInfo* xsi);
+};
+
+#endif
diff --git a/rpc++/service.cc b/rpc++/service.cc
new file mode 100644
index 00000000000..8d548397a87
--- /dev/null
+++ b/rpc++/service.cc
@@ -0,0 +1,316 @@
+// -*- c++ -*-
+/*
+Copyright (C) 1991 Peter Bersen
+
+This file is part of the rpc++ Library. This library is free
+software; you can redistribute it and/or modify it under the terms of
+the GNU Library General Public License as published by the Free
+Software Foundation; either version 2 of the License, or (at your
+option) any later version. This library is distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even the
+implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU Library General Public License for more details.
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Modified and partially rewritten March 1992 by Michael N. Lipp,
+mnl@dtro.e-technik.th-darmstadt.de. The original copyright terms and
+conditions apply without change to any modified or new parts.
+*/
+
+static char _rpcpp_service_cc_[]
+= "service.cc,v 2.3 1992/06/15 19:12:44 mnl Exp";
+
+// service.cc,v
+// Revision 2.3 1992/06/15 19:12:44 mnl
+// Fixed a few bugs, clarified interface.
+//
+// Revision 2.2 1992/06/13 14:27:02 mnl
+// Adapted to (patched) gcc-2.2. Fixed several bugs.
+//
+// Revision 2.1.1.1 1992/03/08 13:28:42 mnl
+// Initial mnl version.
+//
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include <assert.h>
+#include <stream.h>
+#include <memory.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <rpc/rpc.h>
+#include <rpc/svc.h>
+#include "rpc++/service.h"
+#include "rpc++/request.h"
+
+extern "C" {
+ extern int getdtablesize();
+}
+
+//
+// RpcRegistered
+//
+
+class RpcRegistered
+{
+public:
+ RpcRequest request;
+ AnyRpcCallback* callback;
+
+ inline RpcRegistered (const RpcRequest& req, AnyRpcCallback* cb)
+ : request (req), callback (cb) { }
+ inline ~RpcRegistered ()
+ { delete callback; }
+};
+
+//
+// RpcService
+//
+
+RpcService* RpcService::me = 0;
+
+RpcService::RpcService (u_long pnum, u_long vnum)
+{
+ init ();
+ prog = pnum;
+ vers = vnum;
+ // find out if we have been started by inetd and set transp accoringly.
+ sockaddr_in sa;
+ int sasz = sizeof (sa);
+ // if started by inetd, stdin is a socket
+ if (! getsockname (0, (sockaddr*)&sa, &sasz))
+ { // yup, inetd is our parent
+ xprt = svctcp_create(0, 0, 0);
+ }
+ else
+ { // we are standalone
+ (void) pmap_unset(prog, vers);
+ xprt = svctcp_create(RPC_ANYSOCK, 0, 0);
+ }
+ if (xprt == NULL)
+ {
+ HandleError (cantCreateTCPService);
+ return;
+ }
+ if (!svc_register(xprt, prog, vers, RpcServiceCallback, IPPROTO_TCP))
+ {
+ HandleError (cantRegisterService);
+ return;
+ }
+}
+
+RpcService::RpcService (u_long vnum)
+{
+ init ();
+ vers = vnum;
+ prog = 0x40000000;
+ xprt = svctcp_create(RPC_ANYSOCK, 0, 0);
+ if (xprt == NULL)
+ {
+ HandleError (cantCreateTCPService);
+ return;
+ }
+ while (! pmap_set (prog, vers, IPPROTO_TCP, xprt->xp_port))
+ prog++;
+ if (!svc_register(xprt, prog, vers, RpcServiceCallback, IPPROTO_TCP))
+ {
+ HandleError (cantRegisterService);
+ return;
+ }
+}
+
+void RpcService::init ()
+{
+ errorState = noError;
+ if (me)
+ {
+ HandleError (reconstructionAttempt);
+ return;
+ }
+ me = this;
+ handlers = 0;
+ maxHandlerIndex = -1;
+ inbuf = 0;
+ inmax = 0;
+}
+
+RpcService::~RpcService ()
+{
+ svc_unregister (prog, vers);
+ for (int i = 0; i <= maxHandlerIndex; i++)
+ delete handlers[i];
+ delete [] handlers;
+ delete [] inbuf;
+ me = 0;
+}
+
+void RpcService::HandleError ()
+{
+ switch (errorState)
+ {
+ case reconstructionAttempt:
+ cerr << "rpc++: Attempt to construct another instance of RpcService.\n";
+ exit (1);
+ case cantCreateTCPService:
+ cerr << "rpc++: can't create tcp service.\n";
+ exit(1);
+ case cantRegisterService:
+ cerr << form ("rpc++: can't register (%d, %d, tcp).", prog, vers);
+ exit(1);
+ case cantSendReply:
+ cerr << "rpc++: can't reply to RPC call.\n";
+ break;
+ case invalidResult:
+ cerr << "rpc++: registered routine has return NULL pointer.\n";
+ abort ();
+ case notRegistered:
+ cerr << "rpc++: requested RPC routine not registered.\n";
+ break;
+ case cantGetArgs:
+ cerr << "rpc++: can't get procedure arguments.\n";
+ break;
+ case cantFreeArgs:
+ cerr << "rpc++: can't free XDR arguments.\n";
+ break;
+ }
+ errorState = noError;
+}
+
+void RpcService::Register (const RpcRequest& req, const AnyRpcCallback& cb)
+{
+ assert (req.Params () == -1 || cb.Params () == -1
+ || req.Params () == cb.Params ());
+ AnyRpcCallback* cbp = cb.CopyToHeap ();
+ cbp->SetService (this);
+ if (req.RequestNumber () > maxHandlerIndex)
+ {
+ RpcRegistered** reg = new RpcRegistered*[req.RequestNumber () + 10];
+ memcpy (reg, handlers, (maxHandlerIndex + 1) * sizeof (RpcRegistered*));
+ memset (&reg[maxHandlerIndex + 1], 0,
+ (req.RequestNumber () + 10 - (maxHandlerIndex + 1))
+ * sizeof (RpcRegistered*));
+ delete handlers;
+ handlers = reg;
+ maxHandlerIndex = req.RequestNumber () + 10 - 1;
+ }
+ handlers[req.RequestNumber ()] = new RpcRegistered (req, cbp);
+}
+
+void RpcService::Dispatch (svc_req* req, SVCXPRT* transp)
+{
+ xprt = transp;
+ if (req->rq_proc == NULLPROC)
+ {
+ if (! svc_sendreply (xprt, xdr_void, 0))
+ {
+ svcerr_systemerr (xprt);
+ HandleError (cantSendReply);
+ }
+ return;
+ }
+ RpcRegistered* handler = ((req->rq_proc > maxHandlerIndex)
+ ? 0
+ : handlers[req->rq_proc]);
+ if (! handler)
+ {
+ svcerr_noproc (xprt);
+ HandleError (notRegistered);
+ return;
+ }
+ rpcreq = &handler->request;
+
+ int insz = rpcreq->ParamSize ();
+ if (insz > inmax) // does in-data fit in available buffer?
+ { // if not, increase buffer space
+ delete [] inbuf;
+ inbuf = new char[inmax = insz];
+ }
+ void* dataps[rpcreq->Params ()];
+ void** dp = dataps;
+ *dp = inbuf;
+ for (XdrInfo** ip = rpcreq->InInfo(); *ip; ip++, dp++)
+ dp[1] = (char*)dp[0] + (*ip)->Size ();
+
+ memset (inbuf, 0, insz);
+ XdrSeqInfo xsi = { rpcreq->InInfo (), dataps };
+ if (!svc_getargs (xprt, Xdr::XdrParams, &xsi))
+ {
+ if (rpcreq->Type () == RpcRequest::normal) // errors can be reported
+ svcerr_decode (xprt); // only if the client waits for a result
+ HandleError (cantGetArgs);
+ return;
+ }
+ haveReplied = FALSE;
+ void* res = handler->callback->Do (dataps);
+ if (! haveReplied)
+ Reply (res);
+ if (!svc_freeargs (xprt, Xdr::XdrParams, &xsi))
+ HandleError (cantFreeArgs);
+ xprt = 0;
+}
+
+void RpcService::Reply (void* res)
+{
+ haveReplied = TRUE;
+ if (rpcreq->Type () == RpcRequest::normal) // i.e., result expected
+ {
+ xdrproc_t outproc = rpcreq->OutInfo()->Proc ();
+ if (outproc == (xdrproc_t)0)
+ {
+ cerr << "rpc++: RpcRequest has invalid xdrproc_t (0) in out-Info";
+ abort ();
+ }
+ if (res == 0 && outproc != (xdrproc_t)xdr_void)
+ {
+ svcerr_systemerr (xprt);
+ HandleError ();
+ }
+ else if (!svc_sendreply
+ (xprt, rpcreq->OutInfo()->Proc (), res))
+ {
+ svcerr_systemerr (xprt);
+ HandleError (cantSendReply);
+ }
+ }
+}
+
+void RpcService::Provide ()
+{
+ int dtbsz = getdtablesize();
+ fd_set readfds;
+
+ quitLoop = FALSE;
+ while (! quitLoop)
+ {
+ readfds = svc_fdset;
+ switch(select (dtbsz, &readfds, 0, 0, 0))
+ {
+ case -1:
+ if (errno != EBADF)
+ continue;
+ cerr << "PRC++: select: " << sys_errlist[errno] << '\n';
+ return;
+ break;
+ case 0:
+ continue;
+ default:
+ svc_getreqset (&readfds);
+ break;
+ }
+ }
+}
+
+char* RpcService::CallerName ()
+{
+ struct sockaddr_in *sa = Caller ();
+ struct hostent* he = gethostbyaddr (&sa->sin_addr, sizeof (sa->sin_addr),
+ sa->sin_family);
+ return he->h_name;
+}
diff --git a/rpc++/stub.cc b/rpc++/stub.cc
new file mode 100644
index 00000000000..38320d06a8a
--- /dev/null
+++ b/rpc++/stub.cc
@@ -0,0 +1,207 @@
+// -*- c++ -*-
+/*
+Copyright (C) 1991 Peter Bersen
+
+This file is part of the rpc++ Library. This library is free
+software; you can redistribute it and/or modify it under the terms of
+the GNU Library General Public License as published by the Free
+Software Foundation; either version 2 of the License, or (at your
+option) any later version. This library is distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even the
+implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU Library General Public License for more details.
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Modified and partially rewritten March 1992 by Michael N. Lipp,
+mnl@dtro.e-technik.th-darmstadt.de. The original copyright terms and
+conditions apply without change to any modified or new parts.
+*/
+
+static char _rpcpp_stub_cc_[]
+= "stub.cc,v 2.3 1992/06/15 19:12:46 mnl Exp";
+
+// stub.cc,v
+// Revision 2.3 1992/06/15 19:12:46 mnl
+// Fixed a few bugs, clarified interface.
+//
+// Revision 2.2 1992/06/13 14:27:04 mnl
+// Adapted to (patched) gcc-2.2. Fixed several bugs.
+//
+// Revision 2.1.1.1 1992/03/08 13:28:42 mnl
+// Initial mnl version.
+//
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include <stream.h>
+#include <memory.h>
+#include <assert.h>
+#include "rpc++/stub.h"
+
+timeval RpcStub::defaultTimeout = { 25, 0 };
+void* RpcStub::res = 0;
+size_t RpcStub::resmax = 0;
+xdrproc_t RpcStub::resproc = 0;
+
+void RpcStub::init (u_long prog, u_long vers,
+ char* srv, timeval timo, bool connect)
+{
+ errorState = noError;
+ program = prog;
+ version = vers;
+ server = srv;
+ timeout = timo;
+ svc = 0;
+ if (connect)
+ Reconnect ();
+ else
+ errorState = notConnected;
+}
+
+RpcStub::~RpcStub ()
+{
+ if (resproc) // "Call" has been called at least once,
+ clnt_freeres (svc, resproc, res); // free any data allocated by clnt_call
+ if (svc)
+ clnt_destroy (svc);
+}
+
+void* RpcStub::HandleError ()
+{
+ switch (errorState)
+ {
+ case notConnected:
+ cerr << "rpc++: Stub has not been connected to server.\n";
+ case cantCreate:
+ cerr << clnt_spcreateerror ("rpc++") << '\n';
+ break;
+ case cantCall:
+ cerr << clnt_sperror (svc, "rpc++") << '\n';
+ exit (1);
+ }
+ return 0; // suppress compiler warning
+}
+
+void RpcStub::Reconnect ()
+{
+ if (svc)
+ clnt_destroy (svc);
+ svc = clnt_create (server, program, version, "tcp"); // connect to client
+ if (svc == 0) // failed ?
+ {
+ HandleError (cantCreate);
+ errorState = notConnected;
+ return;
+ }
+ errorState = noError;
+}
+
+void* RpcStub::Call (RpcRequest& req, void* in, bool handle_errors)
+{
+ void* args[] = { in };
+ return DoCall (req, args, handle_errors);
+}
+
+void* RpcStub::Call (RpcRequest& req, void* in0, void* in1, bool handle_errors)
+{
+ void* args[] = { in0, in1 };
+ return DoCall (req, args, handle_errors);
+}
+
+void* RpcStub::Call (RpcRequest& req, void* in0, void* in1, void* in2,
+ bool handle_errors)
+{
+ void* args[] = { in0, in1, in2 };
+ return DoCall (req, args, handle_errors);
+}
+
+void* RpcStub::Call (RpcRequest& req, void* in0, void* in1, void* in2,
+ void* in3, bool handle_errors)
+{
+ void* args[] = { in0, in1, in2, in3 };
+ return DoCall (req, args, handle_errors);
+}
+
+void* RpcStub::Call (RpcRequest& req, void* in0, void* in1, void* in2,
+ void* in3, void* in4, bool handle_errors)
+{
+ void* args[] = { in0, in1, in2, in3, in4 };
+ return DoCall (req, args, handle_errors);
+}
+
+void* RpcStub::Call (RpcRequest& req, void* in0, void* in1, void* in2,
+ void* in3, void* in4, void* in5, bool handle_errors)
+{
+ void* args[] = { in0, in1, in2, in3, in4, in5 };
+ return DoCall (req, args, handle_errors);
+}
+
+void* RpcStub::Call (RpcRequest& req, void* in0, void* in1, void* in2,
+ void* in3, void* in4, void* in5, void* in6,
+ bool handle_errors)
+{
+ void* args[] = { in0, in1, in2, in3, in4, in5, in6 };
+ return DoCall (req, args, handle_errors);
+}
+
+void* RpcStub::Call (RpcRequest& req, void** ins, bool handle_errors)
+{
+ return DoCall (req, ins, handle_errors);
+}
+
+void* RpcStub::DoCall (RpcRequest& req, void** args, bool handle_errors)
+{
+ static timeval nullTimeout = { 0, 0 };
+
+ if (! OK () )
+ {
+ if (! handle_errors)
+ return 0;
+ return HandleError ();
+ }
+ if (resproc) // "Call" has been called previously,
+ clnt_freeres (svc, resproc, res); // free any data allocated by clnt_call
+ resproc = req.OutInfo()->Proc (); // current output deserializer
+ if (req.OutInfo()->Size () > resmax) // enough space for result?
+ {
+ delete res; // delete old result buffer
+ res = new char[resmax = req.OutInfo()->Size ()]; // get a new one
+ }
+ if (req.OutInfo()->Size () > 0 ) // preset result (everyone does it, why?)
+ memset (res, 0, req.OutInfo()->Size ());
+
+ XdrSeqInfo xsi = { req.InInfo (), args };
+ if (req.Type () == RpcRequest::normal)
+ {
+ if (clnt_call (svc, req.RequestNumber (), // do call
+ Xdr::XdrParams, &xsi,
+ req.OutInfo()->Proc (), res,
+ timeout) != RPC_SUCCESS)
+ {
+ if (! handle_errors)
+ return 0;
+ return HandleError (cantCall);
+ }
+ return res;
+ }
+
+ // req.Type () is batched or async
+ enum clnt_stat callres;
+ callres = clnt_call (svc, req.RequestNumber (), // do call
+ Xdr::XdrParams, &xsi,
+ (req.Type () == RpcRequest::batched
+ ? (xdrproc_t)0 : xdr_void), res,
+ nullTimeout);
+ if (callres != RPC_SUCCESS && callres != RPC_TIMEDOUT)
+ {
+ if (! handle_errors)
+ return 0;
+ return HandleError (cantCall);
+ }
+ return res;
+}
+
diff --git a/rpc++/version.h b/rpc++/version.h
new file mode 100644
index 00000000000..88a78665b13
--- /dev/null
+++ b/rpc++/version.h
@@ -0,0 +1,4 @@
+// version.h,v 2.2 1992/06/15 19:12:47 mnl Exp
+#ifndef _RPCPLPL_VERSION_H_
+static char* version = "rpc++-library, version 2.2"
+#endif
diff --git a/rpc++/xdr++.cc b/rpc++/xdr++.cc
new file mode 100644
index 00000000000..25f54d2e990
--- /dev/null
+++ b/rpc++/xdr++.cc
@@ -0,0 +1,75 @@
+// -*- c++ -*-
+/*
+Copyright (C) 1991 Peter Bersen
+
+This file is part of the rpc++ Library. This library is free
+software; you can redistribute it and/or modify it under the terms of
+the GNU Library General Public License as published by the Free
+Software Foundation; either version 2 of the License, or (at your
+option) any later version. This library is distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even the
+implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU Library General Public License for more details.
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Modified and partially rewritten March 1992 by Michael N. Lipp,
+mnl@dtro.e-technik.th-darmstadt.de. The original copyright terms and
+conditions apply without change to any modified or new parts.
+*/
+
+static char _rpcpp_xdrpp_cc_[]
+= "xdr++.cc,v 2.3 1992/06/15 19:12:49 mnl Exp";
+
+// xdr++.cc,v
+// Revision 2.3 1992/06/15 19:12:49 mnl
+// Fixed a few bugs, clarified interface.
+//
+// Revision 2.2 1992/06/13 14:27:06 mnl
+// Adapted to (patched) gcc-2.2. Fixed several bugs.
+//
+// Revision 2.1.1.1 1992/03/08 13:28:42 mnl
+// Initial mnl version.
+//
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+/*
+** See Xdr.h.
+*/
+
+#include "rpc++/xdr++.h"
+
+XdrInfo Xdr::Xnull ((xdrproc_t)0, 0);
+XdrInfo Xdr::Xchar ((xdrproc_t)xdr_char, sizeof (char));
+XdrInfo Xdr::Xshort ((xdrproc_t)xdr_short, sizeof (short));
+XdrInfo Xdr::Xint ((xdrproc_t)xdr_int, sizeof (int));
+XdrInfo Xdr::Xlong ((xdrproc_t)xdr_long, sizeof (long));
+XdrInfo Xdr::Xuchar ((xdrproc_t)xdr_u_char, sizeof (u_char));
+XdrInfo Xdr::Xushort ((xdrproc_t)xdr_u_short, sizeof (u_short));
+XdrInfo Xdr::Xuint ((xdrproc_t)xdr_u_int, sizeof (u_int));
+XdrInfo Xdr::Xulong ((xdrproc_t)xdr_u_long, sizeof (u_long));
+XdrInfo Xdr::Xfloat ((xdrproc_t)xdr_float, sizeof (float));
+XdrInfo Xdr::Xdouble ((xdrproc_t)xdr_double, sizeof (double));
+
+XdrInfo Xdr::Xenum_t ((xdrproc_t)xdr_enum, sizeof (enum_t));
+XdrInfo Xdr::Xbool_t ((xdrproc_t)xdr_bool, sizeof (bool_t));
+XdrInfo Xdr::Xvoid ((xdrproc_t)xdr_void, 0);
+XdrInfo Xdr::Xwrapstring ((xdrproc_t)xdr_wrapstring, sizeof (char*));
+
+bool_t Xdr::XdrParams (XDR* xdrs, XdrSeqInfo* xsi)
+{
+ XdrInfo** infop = xsi->infos;
+ void** datap = xsi->data;
+
+ while (*infop)
+ {
+ if (! (*infop->Proc ()) (xdrs, *datap))
+ return FALSE;
+ infop++, datap++;
+ }
+ return TRUE;
+}