Ejemplo n.º 1
0
 /// <summary>
 /// Retrieves a list of all registered ONC/RPC servers at the same host
 /// as the contacted portmapper.
 /// </summary>
 /// <remarks>
 /// Retrieves a list of all registered ONC/RPC servers at the same host
 /// as the contacted portmapper.
 /// </remarks>
 /// <returns>
 /// vector of server descriptions (see
 /// class
 /// <see cref="OncRpcServerIdent">OncRpcServerIdent</see>
 /// ).
 /// </returns>
 /// <exception cref="OncRpcException">
 /// if the portmapper is not available (detail is
 /// <see cref="OncRpcException.RPC_PMAPFAILURE">OncRpcException.RPC_PMAPFAILURE</see>
 /// ).
 /// </exception>
 /// <exception cref="org.acplt.oncrpc.OncRpcException"></exception>
 public virtual org.acplt.oncrpc.OncRpcServerIdent[] listServers()
 {
     //
     // Fill in the request parameters.
     //
     org.acplt.oncrpc.OncRpcDumpResult result = new org.acplt.oncrpc.OncRpcDumpResult(
         );
     //
     // Try to contact the portmap process. If something goes "boing"
     // at this stage, then rethrow the exception as a generic portmap
     // failure exception.
     //
     try
     {
         portmapClient.call(org.acplt.oncrpc.OncRpcPortmapServices.PMAP_DUMP, org.acplt.oncrpc.XdrVoid
                            .XDR_VOID, result);
     }
     catch (org.acplt.oncrpc.OncRpcException)
     {
         throw (new org.acplt.oncrpc.OncRpcException(org.acplt.oncrpc.OncRpcException.RPC_PMAPFAILURE
                                                     ));
     }
     //
     // Copy the server ident object references from the Vector
     // into the vector (array).
     //
     org.acplt.oncrpc.OncRpcServerIdent[] info = new org.acplt.oncrpc.OncRpcServerIdent
                                                 [result.servers.Count];
     result.servers.CopyTo(info);
     return(info);
 }
Ejemplo n.º 2
0
 /// <summary>Return list of registered ONC/RPC servers.</summary>
 /// <remarks>Return list of registered ONC/RPC servers.</remarks>
 /// <returns>
 /// list of ONC/RPC server descriptions (program, version,
 /// protocol, port).
 /// </returns>
 internal virtual OncRpcDumpResult listServers()
 {
     org.acplt.oncrpc.OncRpcDumpResult result = new org.acplt.oncrpc.OncRpcDumpResult(
         );
     result.servers = servers;
     return(result);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Retrieves a list of all registered ONC/RPC servers at the same host
 /// as the contacted portmapper.
 /// </summary>
 /// <remarks>
 /// Retrieves a list of all registered ONC/RPC servers at the same host
 /// as the contacted portmapper.
 /// </remarks>
 /// <returns>
 /// vector of server descriptions (see
 /// class
 /// <see cref="OncRpcServerIdent">OncRpcServerIdent</see>
 /// ).
 /// </returns>
 /// <exception cref="OncRpcException">
 /// if the portmapper is not available (detail is
 /// <see cref="OncRpcException.RPC_PMAPFAILURE">OncRpcException.RPC_PMAPFAILURE</see>
 /// ).
 /// </exception>
 /// <exception cref="org.acplt.oncrpc.OncRpcException"></exception>
 public virtual org.acplt.oncrpc.OncRpcServerIdent[] listServers()
 {
     //
     // Fill in the request parameters.
     //
     org.acplt.oncrpc.OncRpcDumpResult result = new org.acplt.oncrpc.OncRpcDumpResult(
         );
     //
     // Try to contact the portmap process. If something goes "boing"
     // at this stage, then rethrow the exception as a generic portmap
     // failure exception.
     //
     try
     {
         portmapClient.call(org.acplt.oncrpc.OncRpcPortmapServices.PMAP_DUMP, org.acplt.oncrpc.XdrVoid
             .XDR_VOID, result);
     }
     catch (org.acplt.oncrpc.OncRpcException)
     {
         throw (new org.acplt.oncrpc.OncRpcException(org.acplt.oncrpc.OncRpcException.RPC_PMAPFAILURE
             ));
     }
     //
     // Copy the server ident object references from the Vector
     // into the vector (array).
     //
     org.acplt.oncrpc.OncRpcServerIdent[] info = new org.acplt.oncrpc.OncRpcServerIdent
         [result.servers.Count];
     result.servers.CopyTo(info);
     return info;
 }
Ejemplo n.º 4
0
 /// <summary>Return list of registered ONC/RPC servers.</summary>
 /// <remarks>Return list of registered ONC/RPC servers.</remarks>
 /// <returns>
 /// list of ONC/RPC server descriptions (program, version,
 /// protocol, port).
 /// </returns>
 internal virtual OncRpcDumpResult listServers()
 {
     org.acplt.oncrpc.OncRpcDumpResult result = new org.acplt.oncrpc.OncRpcDumpResult(
         );
     result.servers = servers;
     return result;
 }
Ejemplo n.º 5
0
        /// <summary>Dispatch incomming ONC/RPC calls to the individual handler functions.</summary>
        /// <remarks>
        /// Dispatch incomming ONC/RPC calls to the individual handler functions.
        /// The CALLIT method is currently unimplemented.
        /// </remarks>
        /// <param name="call">
        /// The ONC/RPC call, with references to the transport and
        /// XDR streams to use for retrieving parameters and sending replies.
        /// </param>
        /// <param name="program">the portmap's program number, 100000</param>
        /// <param name="version">the portmap's protocol version, 2</param>
        /// <param name="procedure">the procedure to call.</param>
        /// <exception cref="org.acplt.oncrpc.OncRpcException">if an ONC/RPC error occurs.</exception>
        /// <exception cref="System.IO.IOException">if an I/O error occurs.</exception>
        public virtual void dispatchOncRpcCall(org.acplt.oncrpc.server.OncRpcCallInformation
                                               call, int program, int version, int procedure)
        {
            //
            // Make sure it's the right program and version that we can handle.
            // (defensive programming)
            //
            if (program == PMAP_PROGRAM)
            {
                if (version == PMAP_VERSION)
                {
                    switch (procedure)
                    {
                    case 0:
                    {
                        // handle NULL call.
                        call.retrieveCall(org.acplt.oncrpc.XdrVoid.XDR_VOID);
                        call.reply(org.acplt.oncrpc.XdrVoid.XDR_VOID);
                        break;
                    }

                    case OncRpcPortmapServices.PMAP_GETPORT:
                    {
                        // handle port query
                        org.acplt.oncrpc.OncRpcServerIdent @params = new org.acplt.oncrpc.OncRpcServerIdent
                                                                         ();
                        call.retrieveCall(@params);
                        org.acplt.oncrpc.OncRpcGetPortResult result = getPort(@params);
                        call.reply(result);
                        break;
                    }

                    case OncRpcPortmapServices.PMAP_SET:
                    {
                        // handle port registration
                        //
                        // ensure that no remote client tries to register
                        //
                        OncRpcServerIdent @params = new OncRpcServerIdent
                                                        ();
                        call.retrieveCall(@params);
                        org.acplt.oncrpc.XdrBoolean result;
                        if (isLocalAddress(call.peerAddress))
                        {
                            result = setPort(@params);
                        }
                        else
                        {
                            result = new XdrBoolean(false);
                        }
                        call.reply(result);
                        break;
                    }

                    case OncRpcPortmapServices.PMAP_UNSET:
                    {
                        // handle port deregistration
                        OncRpcServerIdent @params = new OncRpcServerIdent
                                                        ();
                        call.retrieveCall(@params);
                        org.acplt.oncrpc.XdrBoolean result;
                        if (isLocalAddress(call.peerAddress))
                        {
                            result = unsetPort(@params);
                        }
                        else
                        {
                            result = new XdrBoolean(false);
                        }
                        call.reply(result);
                        break;
                    }

                    case OncRpcPortmapServices.PMAP_DUMP:
                    {
                        // list all registrations
                        call.retrieveCall(org.acplt.oncrpc.XdrVoid.XDR_VOID);
                        org.acplt.oncrpc.OncRpcDumpResult result = listServers();
                        call.reply(result);
                        break;
                    }

                    default:
                    {
                        // unknown/unimplemented procedure
                        call.failProcedureUnavailable();
                        break;
                    }
                    }
                }
                else
                {
                    call.failProgramMismatch(PMAP_VERSION, PMAP_VERSION);
                }
            }
            else
            {
                call.failProgramUnavailable();
            }
        }