Commit 77d388c7 authored by Lubomir Bulej's avatar Lubomir Bulej

Update protobuf definition

Use ClassInfo structure to send a class name along with a classloader
tag for both the class being instrumented as well as the supertype
classes.
parent d155e382
......@@ -232,94 +232,49 @@ void instrumentation_accept_confirmation__free_unpacked
assert(message->base.descriptor == &instrumentation_accept_confirmation__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
void class_loader_descriptor__init
(ClassLoaderDescriptor *message)
void class_info__init
(ClassInfo *message)
{
static const ClassLoaderDescriptor init_value = CLASS_LOADER_DESCRIPTOR__INIT;
static const ClassInfo init_value = CLASS_INFO__INIT;
*message = init_value;
}
size_t class_loader_descriptor__get_packed_size
(const ClassLoaderDescriptor *message)
size_t class_info__get_packed_size
(const ClassInfo *message)
{
assert(message->base.descriptor == &class_loader_descriptor__descriptor);
assert(message->base.descriptor == &class_info__descriptor);
return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
}
size_t class_loader_descriptor__pack
(const ClassLoaderDescriptor *message,
size_t class_info__pack
(const ClassInfo *message,
uint8_t *out)
{
assert(message->base.descriptor == &class_loader_descriptor__descriptor);
assert(message->base.descriptor == &class_info__descriptor);
return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
}
size_t class_loader_descriptor__pack_to_buffer
(const ClassLoaderDescriptor *message,
size_t class_info__pack_to_buffer
(const ClassInfo *message,
ProtobufCBuffer *buffer)
{
assert(message->base.descriptor == &class_loader_descriptor__descriptor);
assert(message->base.descriptor == &class_info__descriptor);
return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
}
ClassLoaderDescriptor *
class_loader_descriptor__unpack
ClassInfo *
class_info__unpack
(ProtobufCAllocator *allocator,
size_t len,
const uint8_t *data)
{
return (ClassLoaderDescriptor *)
protobuf_c_message_unpack (&class_loader_descriptor__descriptor,
return (ClassInfo *)
protobuf_c_message_unpack (&class_info__descriptor,
allocator, len, data);
}
void class_loader_descriptor__free_unpacked
(ClassLoaderDescriptor *message,
void class_info__free_unpacked
(ClassInfo *message,
ProtobufCAllocator *allocator)
{
if(!message)
return;
assert(message->base.descriptor == &class_loader_descriptor__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
void super_type_descriptor__init
(SuperTypeDescriptor *message)
{
static const SuperTypeDescriptor init_value = SUPER_TYPE_DESCRIPTOR__INIT;
*message = init_value;
}
size_t super_type_descriptor__get_packed_size
(const SuperTypeDescriptor *message)
{
assert(message->base.descriptor == &super_type_descriptor__descriptor);
return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
}
size_t super_type_descriptor__pack
(const SuperTypeDescriptor *message,
uint8_t *out)
{
assert(message->base.descriptor == &super_type_descriptor__descriptor);
return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
}
size_t super_type_descriptor__pack_to_buffer
(const SuperTypeDescriptor *message,
ProtobufCBuffer *buffer)
{
assert(message->base.descriptor == &super_type_descriptor__descriptor);
return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
}
SuperTypeDescriptor *
super_type_descriptor__unpack
(ProtobufCAllocator *allocator,
size_t len,
const uint8_t *data)
{
return (SuperTypeDescriptor *)
protobuf_c_message_unpack (&super_type_descriptor__descriptor,
allocator, len, data);
}
void super_type_descriptor__free_unpacked
(SuperTypeDescriptor *message,
ProtobufCAllocator *allocator)
{
if(!message)
return;
assert(message->base.descriptor == &super_type_descriptor__descriptor);
assert(message->base.descriptor == &class_info__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
void instrument_class_request__init
......@@ -782,66 +737,15 @@ const ProtobufCMessageDescriptor instrumentation_accept_confirmation__descriptor
(ProtobufCMessageInit) instrumentation_accept_confirmation__init,
NULL,NULL,NULL /* reserved[123] */
};
static const ProtobufCFieldDescriptor class_loader_descriptor__field_descriptors[2] =
{
{
"name",
1,
PROTOBUF_C_LABEL_NONE,
PROTOBUF_C_TYPE_STRING,
0, /* quantifier_offset */
offsetof(ClassLoaderDescriptor, name),
NULL,
&protobuf_c_empty_string,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"tag",
2,
PROTOBUF_C_LABEL_NONE,
PROTOBUF_C_TYPE_INT64,
0, /* quantifier_offset */
offsetof(ClassLoaderDescriptor, tag),
NULL,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
};
static const unsigned class_loader_descriptor__field_indices_by_name[] = {
0, /* field[0] = name */
1, /* field[1] = tag */
};
static const ProtobufCIntRange class_loader_descriptor__number_ranges[1 + 1] =
{
{ 1, 0 },
{ 0, 2 }
};
const ProtobufCMessageDescriptor class_loader_descriptor__descriptor =
{
PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
"ClassLoaderDescriptor",
"ClassLoaderDescriptor",
"ClassLoaderDescriptor",
"",
sizeof(ClassLoaderDescriptor),
2,
class_loader_descriptor__field_descriptors,
class_loader_descriptor__field_indices_by_name,
1, class_loader_descriptor__number_ranges,
(ProtobufCMessageInit) class_loader_descriptor__init,
NULL,NULL,NULL /* reserved[123] */
};
static const ProtobufCFieldDescriptor super_type_descriptor__field_descriptors[2] =
static const ProtobufCFieldDescriptor class_info__field_descriptors[2] =
{
{
"name",
"className",
1,
PROTOBUF_C_LABEL_NONE,
PROTOBUF_C_TYPE_STRING,
0, /* quantifier_offset */
offsetof(SuperTypeDescriptor, name),
offsetof(ClassInfo, classname),
NULL,
&protobuf_c_empty_string,
0, /* flags */
......@@ -853,38 +757,38 @@ static const ProtobufCFieldDescriptor super_type_descriptor__field_descriptors[2
PROTOBUF_C_LABEL_NONE,
PROTOBUF_C_TYPE_INT64,
0, /* quantifier_offset */
offsetof(SuperTypeDescriptor, classloadertag),
offsetof(ClassInfo, classloadertag),
NULL,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
};
static const unsigned super_type_descriptor__field_indices_by_name[] = {
static const unsigned class_info__field_indices_by_name[] = {
1, /* field[1] = classLoaderTag */
0, /* field[0] = name */
0, /* field[0] = className */
};
static const ProtobufCIntRange super_type_descriptor__number_ranges[1 + 1] =
static const ProtobufCIntRange class_info__number_ranges[1 + 1] =
{
{ 1, 0 },
{ 0, 2 }
};
const ProtobufCMessageDescriptor super_type_descriptor__descriptor =
const ProtobufCMessageDescriptor class_info__descriptor =
{
PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
"SuperTypeDescriptor",
"SuperTypeDescriptor",
"SuperTypeDescriptor",
"ClassInfo",
"ClassInfo",
"ClassInfo",
"",
sizeof(SuperTypeDescriptor),
sizeof(ClassInfo),
2,
super_type_descriptor__field_descriptors,
super_type_descriptor__field_indices_by_name,
1, super_type_descriptor__number_ranges,
(ProtobufCMessageInit) super_type_descriptor__init,
class_info__field_descriptors,
class_info__field_indices_by_name,
1, class_info__number_ranges,
(ProtobufCMessageInit) class_info__init,
NULL,NULL,NULL /* reserved[123] */
};
static const ProtobufCFieldDescriptor instrument_class_request__field_descriptors[5] =
static const ProtobufCFieldDescriptor instrument_class_request__field_descriptors[4] =
{
{
"flags",
......@@ -898,18 +802,6 @@ static const ProtobufCFieldDescriptor instrument_class_request__field_descriptor
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"className",
3,
PROTOBUF_C_LABEL_NONE,
PROTOBUF_C_TYPE_STRING,
0, /* quantifier_offset */
offsetof(InstrumentClassRequest, classname),
NULL,
&protobuf_c_empty_string,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"classBytes",
4,
......@@ -923,13 +815,13 @@ static const ProtobufCFieldDescriptor instrument_class_request__field_descriptor
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"classLoader",
"classInfo",
5,
PROTOBUF_C_LABEL_NONE,
PROTOBUF_C_TYPE_MESSAGE,
0, /* quantifier_offset */
offsetof(InstrumentClassRequest, classloader),
&class_loader_descriptor__descriptor,
offsetof(InstrumentClassRequest, classinfo),
&class_info__descriptor,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
......@@ -941,23 +833,23 @@ static const ProtobufCFieldDescriptor instrument_class_request__field_descriptor
PROTOBUF_C_TYPE_MESSAGE,
offsetof(InstrumentClassRequest, n_supertypes),
offsetof(InstrumentClassRequest, supertypes),
&super_type_descriptor__descriptor,
&class_info__descriptor,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
};
static const unsigned instrument_class_request__field_indices_by_name[] = {
2, /* field[2] = classBytes */
3, /* field[3] = classLoader */
1, /* field[1] = className */
1, /* field[1] = classBytes */
2, /* field[2] = classInfo */
0, /* field[0] = flags */
4, /* field[4] = superTypes */
3, /* field[3] = superTypes */
};
static const ProtobufCIntRange instrument_class_request__number_ranges[1 + 1] =
static const ProtobufCIntRange instrument_class_request__number_ranges[2 + 1] =
{
{ 2, 0 },
{ 0, 5 }
{ 4, 1 },
{ 0, 4 }
};
const ProtobufCMessageDescriptor instrument_class_request__descriptor =
{
......@@ -967,10 +859,10 @@ const ProtobufCMessageDescriptor instrument_class_request__descriptor =
"InstrumentClassRequest",
"",
sizeof(InstrumentClassRequest),
5,
4,
instrument_class_request__field_descriptors,
instrument_class_request__field_indices_by_name,
1, instrument_class_request__number_ranges,
2, instrument_class_request__number_ranges,
(ProtobufCMessageInit) instrument_class_request__init,
NULL,NULL,NULL /* reserved[123] */
};
......
......@@ -20,8 +20,7 @@ typedef struct _SessionInitRequest SessionInitRequest;
typedef struct _SessionInitResponse SessionInitResponse;
typedef struct _InstrumentationDelivery InstrumentationDelivery;
typedef struct _InstrumentationAcceptConfirmation InstrumentationAcceptConfirmation;
typedef struct _ClassLoaderDescriptor ClassLoaderDescriptor;
typedef struct _SuperTypeDescriptor SuperTypeDescriptor;
typedef struct _ClassInfo ClassInfo;
typedef struct _InstrumentClassRequest InstrumentClassRequest;
typedef struct _InstrumentClassResponse InstrumentClassResponse;
typedef struct _CloseConnection CloseConnection;
......@@ -121,25 +120,14 @@ struct _InstrumentationAcceptConfirmation
, 0, 0,NULL }
struct _ClassLoaderDescriptor
struct _ClassInfo
{
ProtobufCMessage base;
char *name;
int64_t tag;
};
#define CLASS_LOADER_DESCRIPTOR__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&class_loader_descriptor__descriptor) \
, (char *)protobuf_c_empty_string, 0 }
struct _SuperTypeDescriptor
{
ProtobufCMessage base;
char *name;
char *classname;
int64_t classloadertag;
};
#define SUPER_TYPE_DESCRIPTOR__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&super_type_descriptor__descriptor) \
#define CLASS_INFO__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&class_info__descriptor) \
, (char *)protobuf_c_empty_string, 0 }
......@@ -150,15 +138,14 @@ struct _InstrumentClassRequest
{
ProtobufCMessage base;
int32_t flags;
char *classname;
ClassInfo *classinfo;
ProtobufCBinaryData classbytes;
ClassLoaderDescriptor *classloader;
size_t n_supertypes;
SuperTypeDescriptor **supertypes;
ClassInfo **supertypes;
};
#define INSTRUMENT_CLASS_REQUEST__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&instrument_class_request__descriptor) \
, 0, (char *)protobuf_c_empty_string, {0,NULL}, NULL, 0,NULL }
, 0, NULL, {0,NULL}, 0,NULL }
/*
......@@ -339,43 +326,24 @@ InstrumentationAcceptConfirmation *
void instrumentation_accept_confirmation__free_unpacked
(InstrumentationAcceptConfirmation *message,
ProtobufCAllocator *allocator);
/* ClassLoaderDescriptor methods */
void class_loader_descriptor__init
(ClassLoaderDescriptor *message);
size_t class_loader_descriptor__get_packed_size
(const ClassLoaderDescriptor *message);
size_t class_loader_descriptor__pack
(const ClassLoaderDescriptor *message,
/* ClassInfo methods */
void class_info__init
(ClassInfo *message);
size_t class_info__get_packed_size
(const ClassInfo *message);
size_t class_info__pack
(const ClassInfo *message,
uint8_t *out);
size_t class_loader_descriptor__pack_to_buffer
(const ClassLoaderDescriptor *message,
size_t class_info__pack_to_buffer
(const ClassInfo *message,
ProtobufCBuffer *buffer);
ClassLoaderDescriptor *
class_loader_descriptor__unpack
ClassInfo *
class_info__unpack
(ProtobufCAllocator *allocator,
size_t len,
const uint8_t *data);
void class_loader_descriptor__free_unpacked
(ClassLoaderDescriptor *message,
ProtobufCAllocator *allocator);
/* SuperTypeDescriptor methods */
void super_type_descriptor__init
(SuperTypeDescriptor *message);
size_t super_type_descriptor__get_packed_size
(const SuperTypeDescriptor *message);
size_t super_type_descriptor__pack
(const SuperTypeDescriptor *message,
uint8_t *out);
size_t super_type_descriptor__pack_to_buffer
(const SuperTypeDescriptor *message,
ProtobufCBuffer *buffer);
SuperTypeDescriptor *
super_type_descriptor__unpack
(ProtobufCAllocator *allocator,
size_t len,
const uint8_t *data);
void super_type_descriptor__free_unpacked
(SuperTypeDescriptor *message,
void class_info__free_unpacked
(ClassInfo *message,
ProtobufCAllocator *allocator);
/* InstrumentClassRequest methods */
void instrument_class_request__init
......@@ -489,11 +457,8 @@ typedef void (*InstrumentationDelivery_Closure)
typedef void (*InstrumentationAcceptConfirmation_Closure)
(const InstrumentationAcceptConfirmation *message,
void *closure_data);
typedef void (*ClassLoaderDescriptor_Closure)
(const ClassLoaderDescriptor *message,
void *closure_data);
typedef void (*SuperTypeDescriptor_Closure)
(const SuperTypeDescriptor *message,
typedef void (*ClassInfo_Closure)
(const ClassInfo *message,
void *closure_data);
typedef void (*InstrumentClassRequest_Closure)
(const InstrumentClassRequest *message,
......@@ -521,8 +486,7 @@ extern const ProtobufCMessageDescriptor session_init_request__descriptor;
extern const ProtobufCMessageDescriptor session_init_response__descriptor;
extern const ProtobufCMessageDescriptor instrumentation_delivery__descriptor;
extern const ProtobufCMessageDescriptor instrumentation_accept_confirmation__descriptor;
extern const ProtobufCMessageDescriptor class_loader_descriptor__descriptor;
extern const ProtobufCMessageDescriptor super_type_descriptor__descriptor;
extern const ProtobufCMessageDescriptor class_info__descriptor;
extern const ProtobufCMessageDescriptor instrument_class_request__descriptor;
extern const ProtobufCMessageDescriptor instrument_class_response__descriptor;
extern const ProtobufCEnumDescriptor instrument_class_response__instrument_class_result__descriptor;
......
......@@ -37,23 +37,17 @@ message InstrumentationAcceptConfirmation {
repeated Error errors = 2;
}
message ClassLoaderDescriptor {
string name = 1;
int64 tag = 2;
}
message SuperTypeDescriptor {
string name = 1;
message ClassInfo {
string className = 1;
int64 classLoaderTag = 2;
}
// This is the request to the instrumentaion server to instrument attached class.
message InstrumentClassRequest {
int32 flags = 2;
string className = 3;
ClassInfo classInfo = 5;
bytes classBytes = 4;
ClassLoaderDescriptor classLoader = 5;
repeated SuperTypeDescriptor superTypes = 6;
repeated ClassInfo superTypes = 6;
}
// Server response containing either the instrumented classbytes or error message
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment