Ejemplo n.º 1
0
        public override void RegisterEnumSymbols()
        {
            base.RegisterEnumSymbols();

            // Register the Tcp Session State enumeration (values, not flags).
            if (HostController.RegisterEnum("TcpSessionState",
                                            DataType.__uint8,
                                            ref TcpSessionState_Handle))
            {
                for (int enumValue = 0;
                     enumValue < TcpSessionStateNames.Length;
                     enumValue++)
                {
                    HostController.RegisterEnumValue(TcpSessionState_Handle,
                                                     TcpSessionStateNames[enumValue],
                                                     (UInt64)enumValue,
                                                     0);
                }
            }

            // Register the Tcp Packet Flags enumeration (flags, not values).
            if (HostController.RegisterEnum("TcpPacketFlags",
                                            DataType.__uint8,
                                            ref TcpPacketFlags_Handle))
            {
                for (int shift = 0; shift < 8; ++shift)
                {
                    HostController.RegisterEnumValue(TcpPacketFlags_Handle,
                                                     TcpPacketFlagsNames[shift],
                                                     1ul << shift,
                                                     (byte)TcpPacketFlagsNames[shift][0]);
                }
            }
        }
Ejemplo n.º 2
0
        public override void RegisterEnumSymbols()
        {
            base.RegisterEnumSymbols();

            if (HostController.RegisterEnum("MyEnum", DataType.__int32, ref MyEnum_Handle))
            {
                HostController.RegisterEnumValue(MyEnum_Handle, "Val1", (UInt64)MyEnum.Val1, 0);
                HostController.RegisterEnumValue(MyEnum_Handle, "Val2", (UInt64)MyEnum.Val2, 0);
            }

            if (HostController.RegisterEnum("MyFlagsEnum", DataType.__int32, ref MyFlagsEnum_Handle))
            {
                HostController.RegisterEnumValue(MyFlagsEnum_Handle, "Flag0001", (UInt64)MyFlagsEnum.Flag0001, (byte)'A');
                HostController.RegisterEnumValue(MyFlagsEnum_Handle, "Flag0008", (UInt64)MyFlagsEnum.Flag0008, (byte)'B');
                HostController.RegisterEnumValue(MyFlagsEnum_Handle, "FlagdifferentSize", (UInt64)MyFlagsEnum.FlagdifferentSize, (byte)'Z');
            }
        }