/// <summary> /// Creates the raw freeform buffer from the given udp entity. /// </summary> /// <param name="direction">The direction.</param> /// <param name="udpEntity">The UDP entity.</param> /// <returns>Raw freeform buffer.</returns> public static byte[] CreateBuffer(FF_FlowDirection direction, UdpFreeformEntity udpEntity) { using (ILogMethod method = Log.LogMethod(DYN_MODULE_NAME, "CreateEntity")) { byte[] result = default(byte[]); try { // get the gmu factory for the given gmu ip adddress _GMU_Factory gmuFactory = GetGMUFactory(udpEntity.AddressString); if (gmuFactory != null) { if (udpEntity.EntityData != null) { result = gmuFactory[direction].CreateBuffer(udpEntity.EntityData); udpEntity.RawData = result; } else if (udpEntity.RawData != null) { result = udpEntity.RawData; } } } catch (Exception ex) { method.Exception(ex); } return(result); } }
public IFreeformEntity_Msg CopyTo(FF_FlowDirection direction, FFCreateEntityRequest request) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "CopyTo")) { IFreeformEntity_Msg result = null; try { result = FreeformEntityFactory.CreateEntity <IFreeformEntity_Msg>(direction, request); result.IpAddress = this.IpAddress; result.DeviceType = this.DeviceType; result.SessionID = this.SessionID; if (!request.SkipTransactionId) { result.TransactionID = this.TransactionID; } result.IsSecured = this.IsSecured; } catch (Exception ex) { method.Exception(ex); } return(result); } }
public MonTgtParserMappingG2HAttribute(FF_FlowDirection direction, Type freeformTargetType, int faultSource, int faultType, params int[] parendIds) : this(direction, freeformTargetType, null, faultSource, faultType, parendIds) { }
public MonTgtParserMappingH2GAttribute(FF_FlowDirection direction, Type monitorTargetType, int faultSource, int faultType, FF_AppId_H2G_PollCodes pollCode, FF_AppId_SessionIds sessionID) : this(direction, null, monitorTargetType, faultSource, faultType, pollCode, sessionID) { }
public MonTgtParserMappingH2GAttribute(FF_FlowDirection direction, Type freeformTargetType, Type monitorTargetType, int faultSource, int faultType, FF_AppId_H2G_PollCodes pollCode, FF_AppId_SessionIds sessionID) : base(direction, freeformTargetType, monitorTargetType, faultSource, faultType) { this.PollCode = pollCode; this.SessionID = sessionID; }
protected MonTgtParserMappingAttribute(FF_FlowDirection direction, Type freeformTargetType, Type monitorTargetType, int faultSource, int faultType) { this.FreeformTargetType = freeformTargetType; this.MonitorTargetType = monitorTargetType; this.FaultSource = faultSource; this.FaultType = faultType; this.Direction = direction; this.IsPrimary = (faultSource >= -1 && faultType >= -1); }
public IFFFactory this[FF_FlowDirection direction] { get { if (_factories.ContainsKey(direction)) { return(_factories[direction]); } return(null); } set { if (!_factories.ContainsKey(direction)) { _factories.Add(direction, value); } } }
/// <summary> /// Creates the raw freeform buffer from the given entity. /// </summary> /// <param name="direction">The direction.</param> /// <param name="entity">The entity.</param> /// <returns> /// Raw freeform buffer. /// </returns> public static byte[] CreateBuffer(FF_FlowDirection direction, IFreeformEntity entity) { using (ILogMethod method = Log.LogMethod(DYN_MODULE_NAME, "CreateEntity")) { IPAddress ipAddress = IPAddress.None; if (entity is IFreeformEntity_Msg) { ipAddress = ((IFreeformEntity_Msg)entity).IpAddress2; } return(CreateBuffer(direction, new UdpFreeformEntity() { Address = ipAddress, EntityData = entity, })); } }
public string ToStringRaw(FF_FlowDirection direction) { if (_data == null) return string.Empty; ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "ToStringRaw"); StringBuilder sb = new StringBuilder(); try { sb.Append((direction == FF_FlowDirection.G2H ? " ==> " : " <== ") + this.AddressString + " : "); FreeformHelper.ConvertBytesToHexString(this.RawData, sb, string.Empty); } catch (Exception ex) { Log.Exception(PROC, ex); } return sb.ToString(); }
public MonTgtParserMappingG2HAttribute(FF_FlowDirection direction, Type freeformTargetType, Type monitorTargetType, int faultSource, int faultType, params int[] parendIds) : base(direction, freeformTargetType, monitorTargetType, faultSource, faultType) { if (parendIds != null) { this.ParentIds = parendIds; StringBuilder sb = new StringBuilder(); foreach (var parendId in parendIds) { if (sb.Length > 0) sb.Append("_"); sb.Append(parendId); } this.ChildKey = sb.ToString(); } }
public string ToStringRaw(FF_FlowDirection direction) { if (_data == null) { return(string.Empty); } ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "ToStringRaw"); StringBuilder sb = new StringBuilder(); try { sb.Append((direction == FF_FlowDirection.G2H ? " ==> " : " <== ") + this.AddressString + " : "); FreeformHelper.ConvertBytesToHexString(this.RawData, sb, string.Empty); } catch (Exception ex) { Log.Exception(PROC, ex); } return(sb.ToString()); }
public MonTgtParserMappingG2HAttribute(FF_FlowDirection direction, Type freeformTargetType, Type monitorTargetType, int faultSource, int faultType, params int[] parendIds) : base(direction, freeformTargetType, monitorTargetType, faultSource, faultType) { if (parendIds != null) { this.ParentIds = parendIds; StringBuilder sb = new StringBuilder(); foreach (var parendId in parendIds) { if (sb.Length > 0) { sb.Append("_"); } sb.Append(parendId); } this.ChildKey = sb.ToString(); } }
public static T CreateEntity <T>(FF_FlowDirection direction, FFCreateEntityRequest request) where T : IFreeformEntity { using (ILogMethod method = Log.LogMethod(DYN_MODULE_NAME, "CreateG2HEntity")) { T result = default(T); try { _GMU_Factory gmuFactory = GetGMUFactory(request.IPAddress); if (gmuFactory != null) { result = (T)gmuFactory[direction].CreateEntity(request); } } catch (Exception ex) { method.Exception(ex); } return(result); } }
public static T CreateEntity <T>(FF_FlowDirection direction, byte[] buffer, string givenAddress) where T : IFreeformEntity_Msg { using (ILogMethod method = Log.LogMethod(DYN_MODULE_NAME, "CreateEntity")) { IFreeformEntity result = default(IFreeformEntity); try { UdpFreeformEntity udpEntity = CreateUdpEntity(direction, buffer, givenAddress); if (udpEntity != null) { result = CreateEntity(direction, udpEntity); } } catch (Exception ex) { method.Exception(ex); } return((T)result); } }
/// <summary> /// Creates the freeform entity from given buffer. /// </summary> /// <param name="direction">The direction.</param> /// <param name="udpEntity">The UDP entity.</param> /// <returns> /// Freeform entity. /// </returns> public static IFreeformEntity CreateEntity(FF_FlowDirection direction, UdpFreeformEntity udpEntity) { using (ILogMethod method = Log.LogMethod(DYN_MODULE_NAME, "CreateEntity")) { IFreeformEntity result = default(IFreeformEntity); try { // get the gmu factory for this ip address _GMU_Factory gmuFactory = GetGMUFactory(udpEntity.AddressString); if (gmuFactory != null && udpEntity.RawData != null) { result = gmuFactory[direction].CreateEntity(udpEntity.RawData, udpEntity.AddressString); } } catch (Exception ex) { method.Exception(ex); } return(result); } }
public static T CreateEntity <T>(FF_FlowDirection direction, byte[] buffer) where T : IFreeformEntity_Msg { return(CreateEntity <T>(direction, buffer, string.Empty)); }
protected MonTgtParserMappingAttribute(FF_FlowDirection direction, Type freeformTargetType) : this(direction, freeformTargetType, null, -1, -1) { }
public static string CreateBufferHexString(FF_FlowDirection direction, IFreeformEntity entity) { return(CreateBuffer(direction, entity).GetConvertBytesToHexString(string.Empty)); }
public MonTgtParserMappingG2HAttribute(FF_FlowDirection direction, Type freeformTargetType, params int[] parendIds) : this(direction, freeformTargetType, -1, -1, parendIds) { }
public IFreeformEntity_Msg CopyTo(FF_FlowDirection direction, FFCreateEntityRequest request) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "CopyTo")) { IFreeformEntity_Msg result = null; try { result = FreeformEntityFactory.CreateEntity<IFreeformEntity_Msg>(direction, request); result.IpAddress = this.IpAddress; result.DeviceType = this.DeviceType; result.SessionID = this.SessionID; if (!request.SkipTransactionId) result.TransactionID = this.TransactionID; result.IsSecured = this.IsSecured; } catch (Exception ex) { method.Exception(ex); } return result; } }
public FreeformEntityKeyValue(string key, FF_FlowDirection value) { _key = key; _value = value; _fullKey = string.Format("{0}, {1}", _key, _value); }
public ExecutionStepKeyValue(string key, FF_FlowDirection value) { _key = key; _value = value; _fullKey = string.Format("{0}, {1}", _key, _value); }
/// <summary> /// Creates the raw freeform message from the given buffer. /// </summary> /// <param name="direction">The flow direction.</param> /// <param name="buffer">The given buffer.</param> /// <param name="givenAddress">The given address.</param> /// <returns> /// Raw freeform entity. /// </returns> public static UdpFreeformEntity CreateUdpEntity(FF_FlowDirection direction, byte[] buffer, string givenAddress) { using (ILogMethod method = Log.LogMethod("FreeformEntityFactory", "CreateUdpEntity")) { UdpFreeformEntity result = default(UdpFreeformEntity); try { int minLength = _headerLengths[(int)direction]; int hasIPAddress = _headerLengths[(int)direction]; int ipOffset = 0; int ipLength = 0; // invalid message if (buffer == null || buffer.Length < minLength) { Log.Info("Parsing buffer (Failure) : Buffer was not in expected length."); return(result); } method.Info("Parsing buffer (Success)"); // ip address string ipAddress2 = givenAddress; IPAddress ipAddress = null; if (givenAddress.IsEmpty()) { ipLength = FreeformConstants.LEN_GMU_IPADDRESS; ipAddress2 = string.Format("{0:D}.{1:D}.{2:D}.{3:D}", buffer[0], buffer[1], buffer[2], buffer[3]); ipOffset += ipLength; } // parse the ip address if (!IPAddress.TryParse(ipAddress2, out ipAddress)) { method.Info("Parsing ip address (Failure) : Invalid ipaddress from the buffer."); return(result); } method.Info("Parsing ip address (Success)"); // get the factory int dataLength = (buffer.Length - ipLength); _GMU_Factory gmuFactory = GetGMUFactory(ipAddress2); // raw data byte[] dataWithoutIP = new byte[dataLength]; Buffer.BlockCopy(buffer, ipOffset, dataWithoutIP, 0, dataWithoutIP.Length); result = new UdpFreeformEntity() { Address = ipAddress, RawData = dataWithoutIP, ProcessDate = DateTime.Now, }; method.Info("Received ip address : " + ipAddress + ", Data Length : " + dataWithoutIP.Length); } catch (Exception ex) { Log.Exception(method.PROC, ex); } return(result); } }
public static UdpFreeformEntity CreateUdpEntity(FF_FlowDirection direction, byte[] buffer) { return(CreateUdpEntity(direction, buffer, string.Empty)); }