Beispiel #1
0
        /// <summary>
        /// Given a program number "prog", version number "vers", and transport
        /// protocol number "prot", this procedure returns the port number on which the
        /// program is awaiting call requests.
        /// </summary>
        /// <remarks>
        /// Given a program number "prog", version number "vers", and transport
        /// protocol number "prot", this procedure returns the port number on which the
        /// program is awaiting call requests. A port value of zeros means the program
        /// has not been registered. The "port" field of the argument is ignored.
        /// </remarks>
        private XDR Getport(int xid, XDR @in, XDR @out)
        {
            PortmapMapping mapping = PortmapRequest.Mapping(@in);
            string         key     = PortmapMapping.Key(mapping);

            if (Log.IsDebugEnabled())
            {
                Log.Debug("Portmap GETPORT key=" + key + " " + mapping);
            }
            PortmapMapping value = map[key];
            int            res   = 0;

            if (value != null)
            {
                res = value.GetPort();
                if (Log.IsDebugEnabled())
                {
                    Log.Debug("Found mapping for key: " + key + " port:" + res);
                }
            }
            else
            {
                Log.Warn("Warning, no mapping for key: " + key);
            }
            return(PortmapResponse.IntReply(@out, xid, res));
        }
Beispiel #2
0
        /// <summary>
        /// When a program becomes unavailable, it should unregister itself with the
        /// port mapper program on the same machine.
        /// </summary>
        /// <remarks>
        /// When a program becomes unavailable, it should unregister itself with the
        /// port mapper program on the same machine. The parameters and results have
        /// meanings identical to those of "PMAPPROC_SET". The protocol and port number
        /// fields of the argument are ignored.
        /// </remarks>
        private XDR Unset(int xid, XDR @in, XDR @out)
        {
            PortmapMapping mapping = PortmapRequest.Mapping(@in);
            string         key     = PortmapMapping.Key(mapping);

            if (Log.IsDebugEnabled())
            {
                Log.Debug("Portmap remove key=" + key);
            }
            Collections.Remove(map, key);
            return(PortmapResponse.BooleanReply(@out, xid, true));
        }
Beispiel #3
0
        /// <summary>
        /// When a program first becomes available on a machine, it registers itself
        /// with the port mapper program on the same machine.
        /// </summary>
        /// <remarks>
        /// When a program first becomes available on a machine, it registers itself
        /// with the port mapper program on the same machine. The program passes its
        /// program number "prog", version number "vers", transport protocol number
        /// "prot", and the port "port" on which it awaits service request. The
        /// procedure returns a boolean reply whose value is "TRUE" if the procedure
        /// successfully established the mapping and "FALSE" otherwise. The procedure
        /// refuses to establish a mapping if one already exists for the tuple
        /// "(prog, vers, prot)".
        /// </remarks>
        private XDR Set(int xid, XDR @in, XDR @out)
        {
            PortmapMapping mapping = PortmapRequest.Mapping(@in);
            string         key     = PortmapMapping.Key(mapping);

            if (Log.IsDebugEnabled())
            {
                Log.Debug("Portmap set key=" + key);
            }
            map[key] = mapping;
            return(PortmapResponse.IntReply(@out, xid, mapping.GetPort()));
        }
Beispiel #4
0
 /// <summary>This procedure does no work.</summary>
 /// <remarks>
 /// This procedure does no work. By convention, procedure zero of any protocol
 /// takes no parameters and returns no results.
 /// </remarks>
 private XDR NullOp(int xid, XDR @in, XDR @out)
 {
     return(PortmapResponse.VoidReply(@out, xid));
 }
Beispiel #5
0
 /// <summary>This procedure enumerates all entries in the port mapper's database.</summary>
 /// <remarks>
 /// This procedure enumerates all entries in the port mapper's database. The
 /// procedure takes no parameters and returns a list of program, version,
 /// protocol, and port values.
 /// </remarks>
 private XDR Dump(int xid, XDR @in, XDR @out)
 {
     PortmapMapping[] pmapList = Collections.ToArray(map.Values, new PortmapMapping
                                                     [0]);
     return(PortmapResponse.PmapList(@out, xid, pmapList));
 }