public string GetNatType() { string result = String.Empty; foreach (EdgeListener el in AppNode.Node.EdgeListenerList) { if (el is PathEdgeListener) { PathEdgeListener pel = el as PathEdgeListener; if (pel.InternalEL is UdpEdgeListener) { NatTAs nat = pel.InternalEL.LocalTAs as NatTAs; nat.GetEnumerator(); result = nat.NatType; break; } } } return(result); }
public CreateState(PathEdgeListener pel, string rem, string loc, EdgeListener.EdgeCreationCallback ecb) { _pel = pel; RemotePath = rem; LocalPath = loc; ECB = ecb; }
/** * Creates a new Path, the root one, if it doesn't exist, otherwise a * random path. */ public PathEdgeListener CreatePath() { Random rand = new Random(); PathEdgeListener pel = null; lock( _sync ) { string path = Root; while( _pel_map.ContainsKey(path) ) { path = String.Format("/{0}", rand.Next().ToString()); } pel = new PathEdgeListener(this, path, _el); _pel_map[path] = pel; } return pel; }
/** create a new PathEdgeListener */ public PathEdgeListener CreatePath(string path) { PathEdgeListener new_pel = null; if(!path[0].Equals('/')) { path = String.Format("/{0}", path); } lock( _sync ) { //Make sure the path doesn't already exist, if( _pel_map.ContainsKey(path) ) { throw new Exception("Path already exists"); } else { new_pel = new PathEdgeListener(this, path, _el); _pel_map[path] = new_pel; } } return new_pel; }