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
This diff is collapsed.
......@@ -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