コード例 #1
0
class StructGrrMessage(rdf_structs.RDFProtoStruct):
    """A serialization agnostic GrrMessage."""

    type_description = type_info.TypeDescriptorSet(
        rdf_structs.ProtoString(
            name="session_id",
            field_number=1,
            description="Every Flow has a unique session id."),
        rdf_structs.ProtoUnsignedInteger(
            name="request_id",
            field_number=2,
            description="This message is in response to this request number"),
        rdf_structs.ProtoUnsignedInteger(
            name="response_id",
            field_number=3,
            description="Responses for each request."),
        rdf_structs.ProtoString(
            name="name",
            field_number=4,
            description=("This is the name of the client action that will be "
                         "executed. It is set by the flow and is executed by "
                         "the client.")),
        rdf_structs.ProtoBinary(
            name="args",
            field_number=5,
            description="This field contains an encoded rdfvalue."),
        rdf_structs.ProtoString(
            name="source",
            field_number=6,
            description=("Client name where the message came from (This is "
                         "copied from the MessageList)")),
    )
コード例 #2
0
ファイル: sqlite_plugin_test.py プロジェクト: sh1nu11bi/grr
class SqliteTestStruct(rdf_structs.RDFProtoStruct):
    """Custom struct for testing schema generation."""

    type_description = type_info.TypeDescriptorSet(
        rdf_structs.ProtoString(name="string_field", field_number=1),
        rdf_structs.ProtoBinary(name="bytes_field", field_number=2),
        rdf_structs.ProtoUnsignedInteger(name="uint_field", field_number=3),
        rdf_structs.ProtoSignedInteger(name="int_field", field_number=4),
        rdf_structs.ProtoFloat(name="float_field", field_number=5),
        rdf_structs.ProtoDouble(name="double_field", field_number=6),
        rdf_structs.ProtoEnum(name="enum_field",
                              field_number=7,
                              enum_name="EnumField",
                              enum={
                                  "FIRST": 1,
                                  "SECOND": 2
                              }),
        rdf_structs.ProtoBoolean(name="bool_field", field_number=8),
        rdf_structs.ProtoRDFValue(name="urn_field",
                                  field_number=9,
                                  rdf_type="RDFURN"),
        rdf_structs.ProtoRDFValue(name="time_field",
                                  field_number=10,
                                  rdf_type="RDFDatetime"),
        rdf_structs.ProtoRDFValue(name="time_field_seconds",
                                  field_number=11,
                                  rdf_type="RDFDatetimeSeconds"),
        rdf_structs.ProtoRDFValue(name="duration_field",
                                  field_number=12,
                                  rdf_type="Duration"),
        rdf_structs.ProtoEmbedded(name="embedded_field",
                                  field_number=13,
                                  nested=TestEmbeddedStruct))