/// <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)); }
/// <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)); }
/// <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())); }