Commit d155e382 authored by Lubomir Bulej's avatar Lubomir Bulej

Update protocol buffers to support classloader and supertype info

parent 7b833338
......@@ -232,6 +232,96 @@ 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)
{
static const ClassLoaderDescriptor init_value = CLASS_LOADER_DESCRIPTOR__INIT;
*message = init_value;
}
size_t class_loader_descriptor__get_packed_size
(const ClassLoaderDescriptor *message)
{
assert(message->base.descriptor == &class_loader_descriptor__descriptor);
return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
}
size_t class_loader_descriptor__pack
(const ClassLoaderDescriptor *message,
uint8_t *out)
{
assert(message->base.descriptor == &class_loader_descriptor__descriptor);
return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
}
size_t class_loader_descriptor__pack_to_buffer
(const ClassLoaderDescriptor *message,
ProtobufCBuffer *buffer)
{
assert(message->base.descriptor == &class_loader_descriptor__descriptor);
return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
}
ClassLoaderDescriptor *
class_loader_descriptor__unpack
(ProtobufCAllocator *allocator,
size_t len,
const uint8_t *data)
{
return (ClassLoaderDescriptor *)
protobuf_c_message_unpack (&class_loader_descriptor__descriptor,
allocator, len, data);
}
void class_loader_descriptor__free_unpacked
(ClassLoaderDescriptor *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);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
void instrument_class_request__init
(InstrumentClassRequest *message)
{
......@@ -692,7 +782,109 @@ const ProtobufCMessageDescriptor instrumentation_accept_confirmation__descriptor
(ProtobufCMessageInit) instrumentation_accept_confirmation__init,
NULL,NULL,NULL /* reserved[123] */
};
static const ProtobufCFieldDescriptor instrument_class_request__field_descriptors[3] =
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] =
{
{
"name",
1,
PROTOBUF_C_LABEL_NONE,
PROTOBUF_C_TYPE_STRING,
0, /* quantifier_offset */
offsetof(SuperTypeDescriptor, name),
NULL,
&protobuf_c_empty_string,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"classLoaderTag",
2,
PROTOBUF_C_LABEL_NONE,
PROTOBUF_C_TYPE_INT64,
0, /* quantifier_offset */
offsetof(SuperTypeDescriptor, classloadertag),
NULL,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
};
static const unsigned super_type_descriptor__field_indices_by_name[] = {
1, /* field[1] = classLoaderTag */
0, /* field[0] = name */
};
static const ProtobufCIntRange super_type_descriptor__number_ranges[1 + 1] =
{
{ 1, 0 },
{ 0, 2 }
};
const ProtobufCMessageDescriptor super_type_descriptor__descriptor =
{
PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
"SuperTypeDescriptor",
"SuperTypeDescriptor",
"SuperTypeDescriptor",
"",
sizeof(SuperTypeDescriptor),
2,
super_type_descriptor__field_descriptors,
super_type_descriptor__field_indices_by_name,
1, super_type_descriptor__number_ranges,
(ProtobufCMessageInit) super_type_descriptor__init,
NULL,NULL,NULL /* reserved[123] */
};
static const ProtobufCFieldDescriptor instrument_class_request__field_descriptors[5] =
{
{
"flags",
......@@ -730,16 +922,42 @@ static const ProtobufCFieldDescriptor instrument_class_request__field_descriptor
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"classLoader",
5,
PROTOBUF_C_LABEL_NONE,
PROTOBUF_C_TYPE_MESSAGE,
0, /* quantifier_offset */
offsetof(InstrumentClassRequest, classloader),
&class_loader_descriptor__descriptor,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"superTypes",
6,
PROTOBUF_C_LABEL_REPEATED,
PROTOBUF_C_TYPE_MESSAGE,
offsetof(InstrumentClassRequest, n_supertypes),
offsetof(InstrumentClassRequest, supertypes),
&super_type_descriptor__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 */
0, /* field[0] = flags */
4, /* field[4] = superTypes */
};
static const ProtobufCIntRange instrument_class_request__number_ranges[1 + 1] =
{
{ 2, 0 },
{ 0, 3 }
{ 0, 5 }
};
const ProtobufCMessageDescriptor instrument_class_request__descriptor =
{
......@@ -749,7 +967,7 @@ const ProtobufCMessageDescriptor instrument_class_request__descriptor =
"InstrumentClassRequest",
"",
sizeof(InstrumentClassRequest),
3,
5,
instrument_class_request__field_descriptors,
instrument_class_request__field_indices_by_name,
1, instrument_class_request__number_ranges,
......
......@@ -20,6 +20,8 @@ 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 _InstrumentClassRequest InstrumentClassRequest;
typedef struct _InstrumentClassResponse InstrumentClassResponse;
typedef struct _CloseConnection CloseConnection;
......@@ -119,6 +121,28 @@ struct _InstrumentationAcceptConfirmation
, 0, 0,NULL }
struct _ClassLoaderDescriptor
{
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;
int64_t classloadertag;
};
#define SUPER_TYPE_DESCRIPTOR__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&super_type_descriptor__descriptor) \
, (char *)protobuf_c_empty_string, 0 }
/*
* This is the request to the instrumentaion server to instrument attached class.
*/
......@@ -128,10 +152,13 @@ struct _InstrumentClassRequest
int32_t flags;
char *classname;
ProtobufCBinaryData classbytes;
ClassLoaderDescriptor *classloader;
size_t n_supertypes;
SuperTypeDescriptor **supertypes;
};
#define INSTRUMENT_CLASS_REQUEST__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&instrument_class_request__descriptor) \
, 0, (char *)protobuf_c_empty_string, {0,NULL} }
, 0, (char *)protobuf_c_empty_string, {0,NULL}, NULL, 0,NULL }
/*
......@@ -312,6 +339,44 @@ 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,
uint8_t *out);
size_t class_loader_descriptor__pack_to_buffer
(const ClassLoaderDescriptor *message,
ProtobufCBuffer *buffer);
ClassLoaderDescriptor *
class_loader_descriptor__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,
ProtobufCAllocator *allocator);
/* InstrumentClassRequest methods */
void instrument_class_request__init
(InstrumentClassRequest *message);
......@@ -424,6 +489,12 @@ 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,
void *closure_data);
typedef void (*InstrumentClassRequest_Closure)
(const InstrumentClassRequest *message,
void *closure_data);
......@@ -450,6 +521,8 @@ 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 instrument_class_request__descriptor;
extern const ProtobufCMessageDescriptor instrument_class_response__descriptor;
extern const ProtobufCEnumDescriptor instrument_class_response__instrument_class_result__descriptor;
......
......@@ -2239,6 +2239,8 @@ merge_messages(ProtobufCMessage *earlier_msg,
latter_msg->descriptor
->field_ranges,
*earlier_case_p);
if (field_index < 0)
return FALSE;
field = latter_msg->descriptor->fields +
field_index;
} else {
......@@ -2632,6 +2634,8 @@ parse_oneof_member (ScannedMember *scanned_member,
int_range_lookup(message->descriptor->n_field_ranges,
message->descriptor->field_ranges,
*oneof_case);
if (field_index < 0)
return FALSE;
const ProtobufCFieldDescriptor *old_field =
message->descriptor->fields + field_index;
size_t el_size = sizeof_elt_in_repeated_array(old_field->type);
......
/*
* Copyright (c) 2008-2017, Dave Benson and the protobuf-c authors.
* Copyright (c) 2008-2018, Dave Benson and the protobuf-c authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
......@@ -790,13 +790,13 @@ protobuf_c_version_number(void);
* The version of the protobuf-c headers, represented as a string using the same
* format as protobuf_c_version().
*/
#define PROTOBUF_C_VERSION "1.3.0"
#define PROTOBUF_C_VERSION "1.3.1"
/**
* The version of the protobuf-c headers, represented as an integer using the
* same format as protobuf_c_version_number().
*/
#define PROTOBUF_C_VERSION_NUMBER 1003000
#define PROTOBUF_C_VERSION_NUMBER 1003001
/**
* The minimum protoc-c version which works with the current version of the
......
......@@ -14,7 +14,6 @@
#include "connection.h"
#include "config.h"
#include "protobuf-c.h"
#include "dislserver.pb-c.h"
void
......
......@@ -37,11 +37,23 @@ message InstrumentationAcceptConfirmation {
repeated Error errors = 2;
}
message ClassLoaderDescriptor {
string name = 1;
int64 tag = 2;
}
message SuperTypeDescriptor {
string name = 1;
int64 classLoaderTag = 2;
}
// This is the request to the instrumentaion server to instrument attached class.
message InstrumentClassRequest {
int32 flags = 2;
string className = 3;
bytes classBytes = 4;
ClassLoaderDescriptor classLoader = 5;
repeated SuperTypeDescriptor 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