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; ...@@ -20,8 +20,7 @@ typedef struct _SessionInitRequest SessionInitRequest;
typedef struct _SessionInitResponse SessionInitResponse; typedef struct _SessionInitResponse SessionInitResponse;
typedef struct _InstrumentationDelivery InstrumentationDelivery; typedef struct _InstrumentationDelivery InstrumentationDelivery;
typedef struct _InstrumentationAcceptConfirmation InstrumentationAcceptConfirmation; typedef struct _InstrumentationAcceptConfirmation InstrumentationAcceptConfirmation;
typedef struct _ClassLoaderDescriptor ClassLoaderDescriptor; typedef struct _ClassInfo ClassInfo;
typedef struct _SuperTypeDescriptor SuperTypeDescriptor;
typedef struct _InstrumentClassRequest InstrumentClassRequest; typedef struct _InstrumentClassRequest InstrumentClassRequest;
typedef struct _InstrumentClassResponse InstrumentClassResponse; typedef struct _InstrumentClassResponse InstrumentClassResponse;
typedef struct _CloseConnection CloseConnection; typedef struct _CloseConnection CloseConnection;
...@@ -121,25 +120,14 @@ struct _InstrumentationAcceptConfirmation ...@@ -121,25 +120,14 @@ struct _InstrumentationAcceptConfirmation
, 0, 0,NULL } , 0, 0,NULL }
struct _ClassLoaderDescriptor struct _ClassInfo
{ {
ProtobufCMessage base; ProtobufCMessage base;
char *name; char *classname;
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;
int64_t classloadertag; int64_t classloadertag;
}; };
#define SUPER_TYPE_DESCRIPTOR__INIT \ #define CLASS_INFO__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&super_type_descriptor__descriptor) \ { PROTOBUF_C_MESSAGE_INIT (&class_info__descriptor) \
, (char *)protobuf_c_empty_string, 0 } , (char *)protobuf_c_empty_string, 0 }
...@@ -150,15 +138,14 @@ struct _InstrumentClassRequest ...@@ -150,15 +138,14 @@ struct _InstrumentClassRequest
{ {
ProtobufCMessage base; ProtobufCMessage base;
int32_t flags; int32_t flags;
char *classname; ClassInfo *classinfo;
ProtobufCBinaryData classbytes; ProtobufCBinaryData classbytes;
ClassLoaderDescriptor *classloader;
size_t n_supertypes; size_t n_supertypes;
SuperTypeDescriptor **supertypes; ClassInfo **supertypes;
}; };
#define INSTRUMENT_CLASS_REQUEST__INIT \ #define INSTRUMENT_CLASS_REQUEST__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&instrument_class_request__descriptor) \ { 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 * ...@@ -339,43 +326,24 @@ InstrumentationAcceptConfirmation *
void instrumentation_accept_confirmation__free_unpacked void instrumentation_accept_confirmation__free_unpacked
(InstrumentationAcceptConfirmation *message, (InstrumentationAcceptConfirmation *message,
ProtobufCAllocator *allocator); ProtobufCAllocator *allocator);
/* ClassLoaderDescriptor methods */ /* ClassInfo methods */
void class_loader_descriptor__init void class_info__init
(ClassLoaderDescriptor *message); (ClassInfo *message);
size_t class_loader_descriptor__get_packed_size size_t class_info__get_packed_size
(const ClassLoaderDescriptor *message); (const ClassInfo *message);
size_t class_loader_descriptor__pack size_t class_info__pack
(const ClassLoaderDescriptor *message, (const ClassInfo *message,
uint8_t *out); uint8_t *out);
size_t class_loader_descriptor__pack_to_buffer size_t class_info__pack_to_buffer
(const ClassLoaderDescriptor *message, (const ClassInfo *message,
ProtobufCBuffer *buffer); ProtobufCBuffer *buffer);
ClassLoaderDescriptor * ClassInfo *
class_loader_descriptor__unpack class_info__unpack
(ProtobufCAllocator *allocator, (ProtobufCAllocator *allocator,
size_t len, size_t len,
const uint8_t *data); const uint8_t *data);
void class_loader_descriptor__free_unpacked void class_info__free_unpacked
(ClassLoaderDescriptor *message, (ClassInfo *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,
ProtobufCAllocator *allocator); ProtobufCAllocator *allocator);
/* InstrumentClassRequest methods */ /* InstrumentClassRequest methods */
void instrument_class_request__init void instrument_class_request__init
...@@ -489,11 +457,8 @@ typedef void (*InstrumentationDelivery_Closure) ...@@ -489,11 +457,8 @@ typedef void (*InstrumentationDelivery_Closure)
typedef void (*InstrumentationAcceptConfirmation_Closure) typedef void (*InstrumentationAcceptConfirmation_Closure)
(const InstrumentationAcceptConfirmation *message, (const InstrumentationAcceptConfirmation *message,
void *closure_data); void *closure_data);
typedef void (*ClassLoaderDescriptor_Closure) typedef void (*ClassInfo_Closure)
(const ClassLoaderDescriptor *message, (const ClassInfo *message,
void *closure_data);
typedef void (*SuperTypeDescriptor_Closure)
(const SuperTypeDescriptor *message,
void *closure_data); void *closure_data);
typedef void (*InstrumentClassRequest_Closure) typedef void (*InstrumentClassRequest_Closure)
(const InstrumentClassRequest *message, (const InstrumentClassRequest *message,
...@@ -521,8 +486,7 @@ extern const ProtobufCMessageDescriptor session_init_request__descriptor; ...@@ -521,8 +486,7 @@ extern const ProtobufCMessageDescriptor session_init_request__descriptor;
extern const ProtobufCMessageDescriptor session_init_response__descriptor; extern const ProtobufCMessageDescriptor session_init_response__descriptor;
extern const ProtobufCMessageDescriptor instrumentation_delivery__descriptor; extern const ProtobufCMessageDescriptor instrumentation_delivery__descriptor;
extern const ProtobufCMessageDescriptor instrumentation_accept_confirmation__descriptor; extern const ProtobufCMessageDescriptor instrumentation_accept_confirmation__descriptor;
extern const ProtobufCMessageDescriptor class_loader_descriptor__descriptor; extern const ProtobufCMessageDescriptor class_info__descriptor;
extern const ProtobufCMessageDescriptor super_type_descriptor__descriptor;
extern const ProtobufCMessageDescriptor instrument_class_request__descriptor; extern const ProtobufCMessageDescriptor instrument_class_request__descriptor;
extern const ProtobufCMessageDescriptor instrument_class_response__descriptor; extern const ProtobufCMessageDescriptor instrument_class_response__descriptor;
extern const ProtobufCEnumDescriptor instrument_class_response__instrument_class_result__descriptor; extern const ProtobufCEnumDescriptor instrument_class_response__instrument_class_result__descriptor;
......
...@@ -37,23 +37,17 @@ message InstrumentationAcceptConfirmation { ...@@ -37,23 +37,17 @@ message InstrumentationAcceptConfirmation {
repeated Error errors = 2; repeated Error errors = 2;
} }
message ClassLoaderDescriptor { message ClassInfo {
string name = 1; string className = 1;
int64 tag = 2;
}
message SuperTypeDescriptor {
string name = 1;
int64 classLoaderTag = 2; int64 classLoaderTag = 2;
} }
// This is the request to the instrumentaion server to instrument attached class. // This is the request to the instrumentaion server to instrument attached class.
message InstrumentClassRequest { message InstrumentClassRequest {
int32 flags = 2; int32 flags = 2;
string className = 3; ClassInfo classInfo = 5;
bytes classBytes = 4; bytes classBytes = 4;
ClassLoaderDescriptor classLoader = 5; repeated ClassInfo superTypes = 6;
repeated SuperTypeDescriptor superTypes = 6;
} }
// Server response containing either the instrumented classbytes or error message // 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