public ReportPacket(byte[] data) : base(data) { PortType = data[13]; ClientIndex = data[14]; NegResult = data[15]; byte[] tempNatType = ByteExtensions.SubBytes(data, 17, sizeof(int)); NatType = (NatType)BitConverter.ToInt32(tempNatType, 0); byte[] tempNatMappingScheme = ByteExtensions.SubBytes(data, 19, sizeof(int)); NatMappingScheme = (NatMappingScheme)BitConverter.ToInt32(tempNatMappingScheme, 0); Array.Copy(data, 23, GameName, 0, 50); }
public StunResult(NatType natType, IPEndPoint endPoint, IPEndPoint localEndPoint) { NatType = natType; EndPoint = endPoint; LocalEndPoint = localEndPoint; }
public StunResponse(NatType netType, IPEndPoint publicEndPoint) { this.NatType = netType; this.PublicEndPoint = publicEndPoint; }
void TypeAndToken(out IToken tok, out Type ty) { Contract.Ensures(Contract.ValueAtReturn(out tok)!=null); Contract.Ensures(Contract.ValueAtReturn(out ty) != null); tok = Token.NoToken; ty = new BoolType(); /*keep compiler happy*/ List<Type> gt; List<Type> tupleArgTypes = null; switch (la.kind) { case 6: { Get(); tok = t; break; } case 7: { Get(); tok = t; ty = new CharType(); break; } case 9: { Get(); tok = t; ty = new NatType(); break; } case 8: { Get(); tok = t; ty = new IntType(); break; } case 10: { Get(); tok = t; ty = new RealType(); break; } case 11: { Get(); tok = t; ty = new ObjectType(); break; } case 13: { Get(); tok = t; gt = new List<Type>(); if (la.kind == 52) { GenericInstantiation(gt); } if (gt.Count > 1) { SemErr("set type expects only one type argument"); } ty = new SetType(true, gt.Count == 1 ? gt[0] : null); break; } case 14: { Get(); tok = t; gt = new List<Type>(); if (la.kind == 52) { GenericInstantiation(gt); } if (gt.Count > 1) { SemErr("set type expects only one type argument"); } ty = new SetType(false, gt.Count == 1 ? gt[0] : null); break; } case 15: { Get(); tok = t; gt = new List<Type>(); if (la.kind == 52) { GenericInstantiation(gt); } if (gt.Count > 1) { SemErr("multiset type expects only one type argument"); } ty = new MultiSetType(gt.Count == 1 ? gt[0] : null); break; } case 16: { Get(); tok = t; gt = new List<Type>(); if (la.kind == 52) { GenericInstantiation(gt); } if (gt.Count > 1) { SemErr("seq type expects only one type argument"); } ty = new SeqType(gt.Count == 1 ? gt[0] : null); break; } case 12: { Get(); tok = t; ty = new UserDefinedType(tok, tok.val, null); break; } case 17: { Get(); tok = t; gt = new List<Type>(); if (la.kind == 52) { GenericInstantiation(gt); } if (gt.Count == 0) { ty = new MapType(true, null, null); } else if (gt.Count != 2) { SemErr("map type expects two type arguments"); ty = new MapType(true, gt[0], gt.Count == 1 ? new InferredTypeProxy() : gt[1]); } else { ty = new MapType(true, gt[0], gt[1]); } break; } case 18: { Get(); tok = t; gt = new List<Type>(); if (la.kind == 52) { GenericInstantiation(gt); } if (gt.Count == 0) { ty = new MapType(false, null, null); } else if (gt.Count != 2) { SemErr("imap type expects two type arguments"); ty = new MapType(false, gt[0], gt.Count == 1 ? new InferredTypeProxy() : gt[1]); } else { ty = new MapType(false, gt[0], gt[1]); } break; } case 5: { Get(); tok = t; gt = null; if (la.kind == 52) { gt = new List<Type>(); GenericInstantiation(gt); } int dims = tok.val.Length == 5 ? 1 : int.Parse(tok.val.Substring(5)); ty = theBuiltIns.ArrayType(tok, dims, gt, true); break; } case 50: { Get(); tok = t; tupleArgTypes = new List<Type>(); if (StartOf(3)) { Type(out ty); tupleArgTypes.Add(ty); while (la.kind == 22) { Get(); Type(out ty); tupleArgTypes.Add(ty); } } Expect(51); if (tupleArgTypes.Count == 1) { // just return the type 'ty' } else { var dims = tupleArgTypes.Count; var tmp = theBuiltIns.TupleType(tok, dims, true); // make sure the tuple type exists ty = new UserDefinedType(tok, BuiltIns.TupleTypeName(dims), dims == 0 ? null : tupleArgTypes); } break; } case 1: { Expression e; tok = t; NameSegmentForTypeName(out e); tok = t; while (la.kind == 27) { Get(); Expect(1); tok = t; List<Type> typeArgs = null; if (la.kind == 52) { typeArgs = new List<Type>(); GenericInstantiation(typeArgs); } e = new ExprDotName(tok, e, tok.val, typeArgs); } ty = new UserDefinedType(e.tok, e); break; } default: SynErr(164); break; } if (la.kind == 30) { Type t2; Get(); tok = t; Type(out t2); if (tupleArgTypes != null) { gt = tupleArgTypes; } else { gt = new List<Type>{ ty }; } ty = new ArrowType(tok, gt, t2); theBuiltIns.CreateArrowTypeDecl(gt.Count); } }
private void ParseLine(string line) { try { if (string.IsNullOrEmpty(line)) { Logger.Error("ParseLine was passed a null or empty line. This should not happen!"); return; } // string reMatchSystem = ".*?(System:).*?\\(((?:[^)]+)).*?\\)"; // Pre-1.6/2.1 style const string reMatchSystem = ".*?(System:)\"(.*)?\".*?\\(((?:[^)]+)).*?\\)"; Match match = Regex.Match(line, reMatchSystem, RegexOptions.IgnoreCase); if (match.Success) { //TriggerSystemChange(match.Groups[2].Value); } const string reMatchPlayer = "\\{.+\\} (\\d+) x (\\d+).*\\(\\(([0-9.]+):\\d+\\)\\)Name (.+)$"; Match frmatch = Regex.Match(line, reMatchPlayer, RegexOptions.IgnoreCase); if (frmatch.Success) { Logger.Debug("PlayerMatch parsed"); AppendStatus("Successful identity match! ID: " + frmatch.Groups[1] + " IP:" + frmatch.Groups[3]); } const string reMatchNat = @"RxRoute:(\d+)+ Comp:(\d)\[IP4NAT:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})+:(\d{1,5}),(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})+:(\d{1,5}),(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})+:(\d{1,5}),(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})+:(\d{1,5}),(\d),(\d),(\d),(\d{1,4})\]\[Relay:"; Match natmatch = Regex.Match(line, reMatchNat, RegexOptions.IgnoreCase); if (natmatch.Success) { Logger.Debug("Found NAT datapoint for runID " + natmatch.Groups[1] + ": " + natmatch.Groups[11]); NatType clientnat = (NatType)Enum.Parse(typeof(NatType), match.Groups[11].Value); switch (clientnat) { case NatType.Blocked: _tc.TrackMetric("ClientNATBlocked", 1); break; case NatType.Unknown: _tc.TrackMetric("ClientNATUnknown", 1); break; case NatType.Open: _tc.TrackMetric("ClientNATOpen", 1); break; case NatType.FullCone: _tc.TrackMetric("ClientNATFullCone", 1); break; case NatType.Failed: _tc.TrackMetric("ClientNATFailed", 1); break; case NatType.SymmetricUdp: _tc.TrackMetric("ClientNATSymmetricUDP", 1); break; case NatType.Restricted: _tc.TrackMetric("ClientNATRestricted", 1); break; case NatType.Symmetric: _tc.TrackMetric("ClientNATSymmetric", 1); break; } _tc.Flush(); } const string reMatchStats = "machines=(\\d+)&numturnlinks=(\\d+)&backlogtotal=(\\d+)&backlogmax=(\\d+)&avgsrtt=(\\d+)&loss=([0-9]*(?:\\.[0-9]*)+)&&jit=([0-9]*(?:\\.[0-9]*)+)&act1=([0-9]*(?:\\.[0-9]*)+)&act2=([0-9]*(?:\\.[0-9]*)+)"; Match statmatch = Regex.Match(line, reMatchStats, RegexOptions.IgnoreCase); if (statmatch.Success) { Logger.Info("Updating connection statistics."); /* ConnInfo.Srtt = int.Parse(statmatch.Groups[5].Value); * ConnInfo.Loss = float.Parse(statmatch.Groups[6].Value); * ConnInfo.Jitter = float.Parse(statmatch.Groups[7].Value); * ConnInfo.Act1 = float.Parse(statmatch.Groups[8].Value); * ConnInfo.Act2 = float.Parse(statmatch.Groups[9].Value); */ } if (line.Contains("</data>")) { Logger.Debug("End of FriendsXML, send buffer to friendsparser."); _xmlparselist += line; ParseFriendsList(_xmlparselist); return; } if (line.Contains("<item>")) { Logger.Debug("Appending xml item to parselist."); _xmlparselist += line; return; } if (line.Contains("<data>")) { Logger.Debug("Startline for FriendsXML, initialize XML buffer"); _xmlparselist = ""; _xmlparselist += line; return; } if (line.Contains("<FriendWingInvite>")) { Logger.Debug("Wing invite detected, parsing..."); ParseWingInvite(line); } if (line.Contains("ListenResponse->Listening (SUCCESS: User has responded via local talkchannel)")) { AppendStatus("Voice communications established."); } if (line.Contains("NormalFlight") && _scState == "Supercruise") { _scState = "Normalspace"; Logger.Debug("Drop to normal space detected."); //voice.Speak("Dropping to normal space."); } if (line.Contains("Supercruise") && _scState == "Normalspace") { _scState = "Supercruise"; Logger.Debug("Entering supercruise."); //voice.Speak("Entering supercruise."); } /* * if (line.Contains("JoinSession:BeaconSession") && line.Contains(MyClient.ClientIp)) * { * AppendStatus("Client's Beacon in sight."); * MyClient.Self.Beacon = true; * if (_myrescue != null) * { * TPAMessage bcnmsg = new TPAMessage * { * action = "BeaconSpotted:update", * data = new Dictionary<string, string> * { * {"BeaconSpotted", "true"}, * {"RatID", _myplayer.RatId.ToString()}, * {"RescueID", _myrescue.id} * } * }; * _apworker.SendTpaMessage(bcnmsg); * } * } */ } catch (Exception ex) { Logger.Debug("Exception in ParseLine: " + ex.Message + "@" + ex.Source + ":" + ex.Data); _tc.TrackException(ex); } }
public SimNode(AHAddress address, NatType nat, int idx) { this.LocalAddress = address; this.Nat = nat; this.Idx = idx; this._con_table = new SimConnectionTable(); }
/// <summary> /// Default constructor. /// </summary> /// <param name="natType">Specifies UDP network type.</param> /// <param name="publicEndPoint">Public IP end point.</param> public StunResult(NatType natType, IPEndPoint publicEndPoint) { NatType = natType; PublicEndPoint = publicEndPoint; }
public override void Reset() { base.Reset(); NatType = NatType.Unknown; }
public void Clone(ClassicStunResult result) { PublicEndPoint = result.PublicEndPoint; LocalEndPoint = result.LocalEndPoint; NatType = result.NatType; }