internal override IFreeformEntity ParseBufferInternal(ref IFreeformEntity entity, IFreeformEntity rootEntity, int id, byte[] buffer)
        {
            // get and verify the session id
            bool isResponseRequired       = false;
            int  actualSessionId          = 0;
            FF_AppId_SessionIds sessionId = this.GetSessionId(buffer, FreeformConstants.IDX_RECV_SESSION_ID, ref actualSessionId, ref isResponseRequired);

            if (sessionId == FF_AppId_SessionIds.None)
            {
                Log.Warning("Invalid message passed (Invalid session)");
                return(null);
            }

            // create the message
            entity = this.CreateEntity();
            FFMsg_G2H msg = entity as FFMsg_G2H;

            if (msg != null)
            {
                int offset = 0;
                msg.IsResponseRequired = isResponseRequired;
                this.OnParseBufferPart1(msg, buffer, sessionId, ref offset);
                this.OnParseBufferPart2(msg, buffer, ref offset);
                this.OnParseBufferPart3(msg, buffer, ref offset);
            }

            msg.IsResponseRequired = isResponseRequired;
            msg.ActualSessionID    = actualSessionId;
            return(msg);
        }
Exemplo n.º 2
0
 protected virtual void OnParseBufferPart1(FFMsg_H2G msg, byte[] buffer, FF_AppId_SessionIds sessionId, ref int offset)
 {
     msg.DeviceType = (FF_GmuId_DeviceTypes)buffer[offset++];
     msg.PollCode   = buffer.GetBytesToNumberUInt8(offset++, 1).GetAppId <FF_GmuId_H2G_PollCodes, FF_AppId_H2G_PollCodes>();
     msg.SessionID  = sessionId;
     offset++;
     msg.TransactionID = buffer.GetBytesToNumberUInt8(offset++, 1);
 }
Exemplo n.º 3
0
 internal static FFMsg_G2H WrapMessageAndReturn(string ipAddress, FF_FlowInitiation flowInitiation,
     FF_AppId_SessionIds sessionId, params FFTgt_B2B_GMUVarAction_Data[] datas)
 {
     FFMsg_G2H msg = FreeformEntityFactory.CreateG2HMessage(ipAddress, FF_AppId_G2H_Commands.ResponseRequest,
         FF_AppId_G2H_MessageTypes.FreeForm, sessionId,
         WrapTargetsAndReturn(datas));
     msg.FlowInitiation = flowInitiation;
     return msg;
 }
 protected virtual void OnParseBufferPart1(FFMsg_G2H msg, byte[] buffer, FF_AppId_SessionIds sessionId, ref int offset)
 {
     msg.DeviceType  = (FF_GmuId_DeviceTypes)buffer[offset++];
     msg.MessageType = buffer.GetBytesToNumberUInt8(offset++, 1).GetAppId <FF_GmuId_G2H_MessageTypes, FF_AppId_G2H_MessageTypes>();
     msg.Command     = buffer.GetBytesToNumberUInt8(offset++, 1).GetAppId <FF_GmuId_G2H_Commands, FF_AppId_G2H_Commands>();
     msg.SessionID   = sessionId;
     offset++;
     msg.TransactionID = buffer.GetBytesToNumberUInt8(offset++, 1);
 }
 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)
 {
 }
Exemplo n.º 6
0
        internal static FFMsg_G2H WrapMessageAndReturn(string ipAddress, FF_FlowInitiation flowInitiation,
                                                       FF_AppId_SessionIds sessionId, params FFTgt_B2B_GMUVarAction_Data[] datas)
        {
            FFMsg_G2H msg = FreeformEntityFactory.CreateG2HMessage(ipAddress, FF_AppId_G2H_Commands.ResponseRequest,
                                                                   FF_AppId_G2H_MessageTypes.FreeForm, sessionId,
                                                                   WrapTargetsAndReturn(datas));

            msg.FlowInitiation = flowInitiation;
            return(msg);
        }
Exemplo n.º 7
0
 public FFMsg_H2G CreateH2GMessage(string ipAddress, FF_AppId_SessionIds sessionId,
                                   FF_AppId_H2G_PollCodes pollCode)
 {
     return(FreeformEntityFactory.CreateEntity <FFMsg_H2G>(FF_FlowDirection.H2G,
                                                           new FFCreateEntityRequest_H2G()
     {
         IPAddress = ipAddress,
         PollCode = pollCode,
         SessionID = sessionId,
         TransactionID = this.TransactionIDNew,
     }));
 }
 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;
 }
        private static FreeformExecutorBase GetMessageType(FF_AppId_SessionIds SessionID)
        {
            switch (SessionID)
            {
                case FF_AppId_SessionIds.A1:
                    return _executorNonPriority;

                case FF_AppId_SessionIds.GIM:
                    return _executorGIM;

                default:
                    return _executorPriority;
            }
        }
Exemplo n.º 10
0
 public FFMsg_G2H CreateG2HMessage(string ipAddress, FF_AppId_SessionIds sessionId,
     FF_AppId_G2H_Commands command, FF_AppId_G2H_MessageTypes messageType,
     int transactionId)
 {
     return FreeformEntityFactory.CreateEntity<FFMsg_G2H>(FF_FlowDirection.G2H,
         new FFCreateEntityRequest_G2H()
         {
             IPAddress = ipAddress,
             Command = command,
             MessageType = messageType,
             SessionID = sessionId,
             TransactionID = transactionId,
         });
 }
Exemplo n.º 11
0
 public FFMsg_G2H CreateG2HMessage(string ipAddress, FF_AppId_SessionIds sessionId,
                                   FF_AppId_G2H_Commands command, FF_AppId_G2H_MessageTypes messageType,
                                   int transactionId)
 {
     return(FreeformEntityFactory.CreateEntity <FFMsg_G2H>(FF_FlowDirection.G2H,
                                                           new FFCreateEntityRequest_G2H()
     {
         IPAddress = ipAddress,
         Command = command,
         MessageType = messageType,
         SessionID = sessionId,
         TransactionID = transactionId,
     }));
 }
        private static FreeformExecutorBase GetMessageType(FF_AppId_SessionIds SessionID)
        {
            switch (SessionID)
            {
            case FF_AppId_SessionIds.A1:
                return(_executorNonPriority);

            case FF_AppId_SessionIds.GIM:
                return(_executorGIM);

            default:
                return(_executorPriority);
            }
        }
        public static FFMsg_H2G CreateH2GMessage(string ipAddress, FF_AppId_H2G_PollCodes pollcode,
                                                 FF_AppId_SessionIds sessionId, bool isResponseRequired,
                                                 params IFreeformEntity_MsgTgt[] targets)
        {
            FFMsg_H2G msg = FreeformEntityFactory.CreateEntity <FFMsg_H2G>(FF_FlowDirection.H2G,
                                                                           new FFCreateEntityRequest_H2G_ResponseRequired()
            {
                PollCode           = pollcode,
                SessionID          = sessionId,
                IPAddress          = ipAddress,
                SkipTransactionId  = true,
                IsResponseRequired = isResponseRequired,
            });

            if (targets != null)
            {
                msg.AddTargets(targets);
            }
            return(msg);
        }
        public static FFMsg_G2H CreateG2HMessage(string ipAddress, FF_AppId_G2H_Commands command, FF_AppId_G2H_MessageTypes messageType,
                                                 FF_AppId_SessionIds sessionId, bool isResponseRequired,
                                                 params IFreeformEntity_MsgTgt[] targets)
        {
            FFMsg_G2H msg = FreeformEntityFactory.CreateEntity <FFMsg_G2H>(FF_FlowDirection.G2H,
                                                                           new FFCreateEntityRequest_G2H_ResponseRequired()
            {
                Command            = command,
                MessageType        = messageType,
                SessionID          = sessionId,
                IPAddress          = ipAddress,
                SkipTransactionId  = true,
                IsResponseRequired = isResponseRequired,
            });

            if (targets != null)
            {
                msg.AddTargets(targets);
            }
            return(msg);
        }
 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 virtual void OnParseBufferPart1(FFMsg_H2G msg, byte[] buffer, FF_AppId_SessionIds sessionId, ref int offset)
 {
     msg.DeviceType = (FF_GmuId_DeviceTypes)buffer[offset++];
     msg.PollCode = buffer.GetBytesToNumberUInt8(offset++, 1).GetAppId<FF_GmuId_H2G_PollCodes, FF_AppId_H2G_PollCodes>();
     msg.SessionID = sessionId;
     offset++;
     msg.TransactionID = buffer.GetBytesToNumberUInt8(offset++, 1);
 }
Exemplo n.º 18
0
 internal static FFMsg_G2H WrapMessageAndReturn(string ipAddress, FF_AppId_SessionIds sessionId,
                                                params FFTgt_B2B_GMUVarAction_Data[] datas)
 {
     return(WrapMessageAndReturn(ipAddress, FF_FlowInitiation.Any, sessionId, datas));
 }
 protected virtual void OnParseBufferPart1(FFMsg_G2H msg, byte[] buffer, FF_AppId_SessionIds sessionId, ref int offset)
 {
     msg.DeviceType = (FF_GmuId_DeviceTypes)buffer[offset++];
     msg.MessageType = buffer.GetBytesToNumberUInt8(offset++, 1).GetAppId<FF_GmuId_G2H_MessageTypes, FF_AppId_G2H_MessageTypes>();
     msg.Command = buffer.GetBytesToNumberUInt8(offset++, 1).GetAppId<FF_GmuId_G2H_Commands, FF_AppId_G2H_Commands>();
     msg.SessionID = sessionId;
     offset++;
     msg.TransactionID = buffer.GetBytesToNumberUInt8(offset++, 1);
 }
 public static FFMsg_H2G CreateH2GMessage(string ipAddress, FF_AppId_H2G_PollCodes pollcode,
                                          FF_AppId_SessionIds sessionId,
                                          params IFreeformEntity_MsgTgt[] targets)
 {
     return(CreateH2GMessage(ipAddress, pollcode, sessionId, false, targets));
 }
 public static FFMsg_G2H CreateG2HMessage(string ipAddress, FF_AppId_G2H_Commands command, FF_AppId_G2H_MessageTypes messageType,
                                          FF_AppId_SessionIds sessionId,
                                          params IFreeformEntity_MsgTgt[] targets)
 {
     return(CreateG2HMessage(ipAddress, command, messageType, sessionId, false, targets));
 }
        internal static IFreeformEntity_Msg InitKeyExchangeStartG2H_SIM(this FreeformSecurityTableCollection secTables, string ipAddress, FF_AppId_SessionIds sessionId, int transactionId)
        {
            FreeformEntity_Msg message = FreeformEntityFactory.CreateEntity <FFMsg_G2H>(FF_FlowDirection.G2H,
                                                                                        new FFCreateEntityRequest_G2H_ResponseRequired()
            {
                Command       = FF_AppId_G2H_Commands.ResponseRequest,
                MessageType   = FF_AppId_G2H_MessageTypes.FreeForm,
                SessionID     = sessionId,
                TransactionID = transactionId,
                IPAddress     = ipAddress,
            });

            InitSecurityData(message, new FFTgt_B2B_Security_KeyExchange_Request());
            return(message);
        }
Exemplo n.º 23
0
 internal static FFMsg_G2H WrapMessageAndReturn(string ipAddress, FF_AppId_SessionIds sessionId,
     params FFTgt_B2B_GMUVarAction_Data[] datas)
 {
     return WrapMessageAndReturn(ipAddress, FF_FlowInitiation.Any, sessionId, datas);
 }
Exemplo n.º 24
0
 public FFMsg_H2G CreateH2GMessage(string ipAddress, FF_AppId_SessionIds sessionId,
     FF_AppId_H2G_PollCodes pollCode)
 {
     return FreeformEntityFactory.CreateEntity<FFMsg_H2G>(FF_FlowDirection.H2G,
         new FFCreateEntityRequest_H2G()
         {
             IPAddress = ipAddress,
             PollCode = pollCode,
             SessionID = sessionId,
             TransactionID = this.TransactionIDNew,
         });
 }